images — list local imagespull — download an image from hubsearch — search hub for imagesbuildrmicreate — create a containerstart — start a stopped containerrun — create and start a containerstop — stop a running containerps -a — list all running and stopped containersrm — remove a container
attach — connect to a running bash prompt (for example)logs -f — watch terminal outputtop — inspect processes in containerexec — run a one-off process in an already-running containercp — copy files to/from the containerrun -it [image] [command] - creates a container out of an image and runs a command in itrun -it [image] /bin/bash - creates a container out of an image and opens you a shell in itrun --name [new-container] [image]logs -f [container]exec -it [container] [command] - run a command in a running containerexec -it [container] /bin/bash - log you in to a running containerRun a temporary container:
Dockerfile in this folder:
docker run --rm -it -v $(pwd):/myapp $(docker build -q .)
docker build . - build an image from the Dockerfile in the current directory
-q output the built image hash$() insert that built image hash
docker run - run a container--rm - remove the container when done-it - interactive terminal-v mount a volume$(pwd) - current directory/myapp - path within the container