Docker Cheat Sheet – JudisWeb

Docker Cheat Sheet – Docker is an open source platform that uses OS-level virtualization to deliver software in packages called container. Container is a unit of software that packages code and all of its dependencies so that applications run quickly and reliably from one computing environment to another.

List of Commands in Docker

In this section we will learn the most important commands related to Docker containers. Making it easier for us to run Docker.

Docker Container Commands

Docker Cheat Sheet Container Commands
Docker Container Commands
docker create [IMAGE] Creating a container without starting it
docker rename [CONTAINER_NAME] [NEW_CONTAINER_NAME] Rename an existing container
docker run [IMAGE] [COMMAND] Executing commands on containers
docker rm [CONTAINER] Removing containers
docker updates [CONTAINER] Update container configuration

Starting/Stoping Container

startstop container
Start / Stop Containers
docker start [CONTAINER] Starting a container
docker stop [CONTAINER] Stop the running container
docker restart [CONTAINER] Stop the running container then restart it
docker pause [CONTAINER] Pause the process while the container is running
docker unpause [CONTAINER] Unpause the container process
docker wait [CONTAINER] Block the container until the other container stops (after that it prints the exit code):
docker attach [CONTAINER] Attaching local standard input, output, and errors to running containers
docker kill [CONTAINER] Stop the container process by sending SIGKILL to the running container

Docker Image Commands

docker images commands
docker build [URL] Creating an image from a Dockerfile
docker pull [IMAGE] Pulling image from registry
docker push [IMAGE] Pushing image to registry
docker import [URL/FILE] Creating an image from a tarball
docker commit [CONTAINER] [NEW_IMAGE_NAME] Creating an image from a container
docker rmi [IMAGE] Deleting image
docker load [TAR_FILE/STDIN_FILE] Loading an image from a tar or stdin archive:
docker save [IMAGE] > [TAR_FILE] Save image to tar archive, stream to STDOUT with all parent layers, tags and versions

Docker Commands for Managing Networks

docker manage networks
docker network ls Show network list
docker network rm [NETWORK] Delete network
docker network inspect [NETWORK] Display network information
docker network connect [NETWORK] [CONTAINER] Connecting containers to the network
docker network disconnect [NETWORK] [CONTAINER] Disconnecting the container from the network

Usage example:

docker network
Docker network
docker network ls
NETWORK ID     NAME      DRIVER    SCOPE
7efc37be1134   bridge    bridge    local
d48643e729c2   host      host      local
18c47b9baa1e   none      null      local

Image and Container Information

docker ps Displays a list of running containers
docker logs [CONTAINER] Displays a list of logs of running containers
docker inspect [OBJECT_NAME/ID] Displaying low-level information on Docker objects
docker events [CONTAINER] Displays real-time information on any event on the running container
docker port [CONTAINER] Displays port mapping for containers
docker top [CONTAINER] Displays running processes on the container
docker stats [CONTAINER] Displays resource usage statistics directly from the container
docker diff [CONTAINER] Displays changes to files (or directories) on the file system
dock image ls Displays a list of all locally stored images with docker engine
docker history [IMAGE] Show history

Download Docker Cheat Sheet PDF

To install Docker with the Ubuntu operating system, you can read the tutorial here.

References:

Conclusion




Leave a comment

Your email address will not be published.