Docker
Docker is a developer tool to containerize applications.
Common commands
Look at currently running containers:
docker ps
Look at built images:
docker image ls
Build an image:
docker build -t <container-name> [--file <file-name>].
- If the
Dockerfile
is not namedDockerfile
a custom name can be specified using the-f
or--file
flag.
Run image:
docker run -p 8080:80 <container-name>
- The
-p
or--port
flag tells Docker to forward public port8080
to the internal port80
. - Optionally a
-d
(detached) flag can be added to let Docker run the container detached.
Look inside current running container:
docker exec -it <container-id> sh
<container-id>
can be found by executingdocker ps
.- The
-i
flag stands for ‘interactive’ and allows for mouse input - The
-t
flag stands for ‘terminal’ and allows for terminal in-/output