Commands Flashcards
Create a container (without starting it)
docker create [IMAGE]
Rename an existing container
docker rename [CONTAINER_NAME] [NEW_CONTAINER_NAME]
Run a command in a new container
docker run [IMAGE] [COMMAND]
Run a command in a new container – and then remove the container after it exits.
docker run –rm [IMAGE]
Start a container and keeps it running.
docker run -td [IMAGE]
Start a container, allocates a pseudo-TTY connected to the container’s stdin, and creates an interactive bash shell in the container.
docker run -it [IMAGE]
Creates, starts, and runs a command inside the container.
Once it executes the command, the container is removed.
docker run -it-rm [IMAGE]
Delete a container (if it is not running)
docker rm [CONTAINER]
Update the configuration of one or more containers
docker update [CONTAINER]
Start a container
docker start [CONTAINER]
Stop a running container
docker stop [CONTAINER]
Stop a running container and start it up again
docker restart [CONTAINER]
Pause processes in a running container
docker pause [CONTAINER]
Unpause processes in a running container
docker unpause [CONTAINER]
Block a container until others stop (after which it prints their exit codes)
docker wait [CONTAINER]
Kill a container by sending a SIGKILL to a running container
docker kill [CONTAINER]
Attach local standard input, output, and error streams to a running container
docker attach [CONTAINER]
Create an image from a Dockerfile
docker build [URL]
– builds an image from a Dockerfile in the current directory and tags the image
docker build -t
Pull an image from a registry
docker pull [IMAGE]
Push an image to a registry
docker push [IMAGE]
Create an image from a tarball
docker import [URL/FILE]