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
Dockerfileis not namedDockerfilea custom name can be specified using the-for--fileflag.
Run image:
docker run -p 8080:80 <container-name>
- The
-por--portflag tells Docker to forward public port8080to 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
-iflag stands for ‘interactive’ and allows for mouse input - The
-tflag stands for ‘terminal’ and allows for terminal in-/output