Web dev

Docker Container Cheat Sheet

Docker Container Cheat Sheet

Building and developing with Docker

docker login: Log into the Docker Hub repository.
docker search [term]: Search the Docker Hub repository for a particular term.
docker create [image]: Create a new container from a particular image.
docker pull [image]: Pull an image from the Docker Hub repository.
docker push [username/image]: Push an image to the Docker Hub repository.
docker tag [source] [target]: Create a target tag or alias that refers to a source image.

Running Docker Containers

docker start [container]: Start a particular container.
docker stop [container]: Stop a particular container.
docker exec -ti [container] [command]: Run a shell command inside a particular container.
docker run -ti — image [image] [container] [command]: Create and start a container at the same time, and then run a command inside it.
docker run -ti — rm — image [image] [container] [command]: Create and start a container at the same time, run the command and, remove the container after executing the command.
docker pause [container]: Pause all processes running within a particular container.

Utilities

docker images: List all of the images that are currently stored on the system.
docker history [image]
: Display the history of a particular image.
docker rmi [image]: Remove a specific image
docker inspect [object]: Display low-level information about a particular Docker object.
docker ps: List all of the containers that are currently running.
docker logs [container]: Display the logs of a container.
docker version: Display the version of Docker that is currently installed on the system.
docker kill [container]: Kill a particular container.
docker kill $(docker ps -q): Kill all containers that are currently running.
docker rm [container]: Delete a particular container that is not currently running.
docker rm $(docker ps -a -q): Delete all containers that are not currently running.

Leave a Comment