Docker: Cheat Sheet
Last updated on
Photo by Ian Taylor / Unsplash
docker run : Create and start a new container from an image. Example: docker run ubuntudocker start : Start an existing container. Example: docker start my_containerdocker stop : Stop a running container. Example: docker stop my_containerdocker exec : Run a command inside a running container. Example: docker exec my_container bashdocker ps : List all running containers.docker ps -a : List all containers, running and stopped.docker rm: Remove a container. Example: docker rm my_containerdocker images: List all images on the system.docker pull: Download an image from a registry. Example: docker pull ubuntudocker rmi: Remove an image. Example: docker rmi ubuntudocker logs: Show logs for a container. Example: docker logs my_containerdocker inspect : View detailed information about a container or image. Example: docker inspect my_containerdocker volume create : Create a new volume. Example: docker volume create my_volumedocker volume ls : List all volumesdocker volume rm : Remove a volume. Example: docker volume rm my_volumedocker network create : Create a new network. Example: docker network create my_networkdocker network ls : List all networksdocker network rm : Remove a network. Example: docker network rm my_networkdocker run --name: Assign a name to a container at creation time. Example: docker run --name my_container ubuntudocker run -d : Run a container in detached mode.docker run -p : Publish a container's port(s) to the host. Example: docker run -p 8080:80 nginxdocker run -e