Description about the Docker Commands Cheat Sheet

Description about the Docker Commands Cheat Sheet
Written by Nilima PaulFebruary 19, 2022
12 min read
Nilima Paul

Technology Security Analyst

We will know in this article, what's the Docker Commands Cheat Sheet.

Introduction to Docker Commands Cheat Sheet:

The accompanying article gives a layout to Docker Commands Cheat Sheet. With DevOps assuming control over all the product business, there is a requirement for devices that can do movements of every kind in the product advancement life cycle together. Docker is an apparatus intended to make, send and show various applications to utilizing holders. These compartments assist the engineer to make bundles for an application with every one of the parts that are required in the program. These can be various libraries and different conditions and boat it out to the bundle. It goes about as a virtual machine. It permits the applications to involve the very Linux portion as the framework that they are running and requires just the applications that are to be delivered and things that are not previously running on the PC.

Basic Docker Commands Cheat Sheet:

Following are some basic docker commands cheat sheets:

1. docker version

This command will give the currently installed version:


docker version

2. docker help

This Cheat Sheet Docker command provides the entire list of commands that the client understands. Most of the commands present here are used to deal with the containers.


docker --help

3. docker start

This command lets the user start a particular container.


docker start [container]


docker start iisnanobase

4. docker ps

This command helps in getting all running containers as well as the containers that are exited from.


docker ps -a

5. docker exec -ti [container] [command]

This Docker Commands Cheat Sheet can be used to run any shell command inside any particular container.


docker exec -ti [container] [command]


docker exec demo powershell.exe ipconfig

6. docker run -ti –rm –image

This Cheat Sheet Docker command does the work of creating and starting a container at the same time. It can also run the command in it and, in the end, remove the container after executing this command.


docker run --rm Nginx Nginx -h

7. docker inspect

This Cheat Sheet Docker command is useful in getting displayed the low-level information of any particular Docker object.


docker inspect Microsoft/dynamics-nav:dev preview

8. docker kill

This command is used to kill the container by stopping the execution of the container. Its kill is different from ‘docker stop’ as ‘docker stop’ gives the container time to shut down properly, and in such situations, it takes longer to stop. The kill command, on the other hand, stops the process immediately.


docker kill fc5e91dfe6f6

9. docker commit

This command helps in creating a new image of any edited container that is already existing on the container.

10. docker login

If a user wants to log in to the Docker repository, then the user must make use of this command.


docker login

Intermediate Docker Commands Cheat Sheet:

Below commands can be used on an intermediate level by any user.

1. docker push

This command can be used to push an image to the docker hub repository.

The syntax for this command is as below:

docker push <username/image name>

2. docker images

This command lists all images that are stored locally on a computer. It also lists all images, including all intermediate images on the terminal.

3. docker build

By using this command, a docker image is built from a Docker file. The time at the end of the command specifies the context, which is built using the Docker image. Also, if the file does not reside in the same folder where the command is being run, the user needs to add the ‘-F flag to specify the folder where the file resides.

4. docker pulls

This command can be used to pull an image from the docker registry to your computer. Also, a specific version of an image can be pulled.

5. docker tag

This helps in tagging the image with any tag that helps the registry that will be used instead of the one that was used locally. This tag can be the same as the local tag.

6 .docker rm $(docker ps -a -q)

This command is useful when a user deletes all containers that are currently not in a running state. By hitting this command, all unnecessary containers will be deleted.

7. docker create –name container_name image_name: tag

This Cheat Sheet Docker command is useful when a container from any image is to be instantiated. It is always required that you name the file or image by providing the –name parameter. Once this is done, it is required to run the docker start container_name and docker stop container_name commands. Once the container is created, it can be run for further uses.

8. docker rmi

This command is useful when the user wants to delete an image from the local image store.

9. docker ps

IToget a list of all containers that are currently running, the user can use this command and get a complete list.

10. docker-machine env default

If the user wants to configure the environment variables, then this command will come to your rescue. ‘default’ here suggests that without any additional complexity, this command should run and set the command line variables. As a developer, you can also list the available machines with the docker-machine ls command and start or stop any particular machines.

Advanced Docker Commands Cheat Sheet:

Below are some advanced docker commands cheat sheets:

1. Using multiple Docker Compose Files

These Cheat Sheet Docker Commands utilize different docker records; an engineer should change the application with its surroundings, organizing, and creation. The Docker Compose order helps in taking this forward as it as of now peruses two documents as a matter of course.


$ docker-compose up -f my-override-1.yml my-override-2.yml

Developer can use the –f option to docker-compose up to use multiple files.

2. Using ONBUILD Commands in Images

This ONBUILD order indicates various orders which are to be run when another picture is being worked from the picture that is being utilized. It tends to be considered an idea of legacy.


ONBUILD COPY package.json /app

Tips and Tricks for Docker Commands Cheat Sheet:

Below, tricks on Commands Cheat Sheet can help you save a lot of time.

1. Tailing logs

TO quickly have a look at logs, the below command can be used.


sudo docker logs -t-tail 1000 my_postgres 2>&1 | grep -I error

2. Copy and paste files

Docker enables you to copy and paste files into a container. It can be done from host to container and vice versa.


COPY /tmp
ADD /tmp

3. Stop all containers

All containers can be stopped by using the below command.


docker stop $(docker ps -q)

It will run stop only for active.


docker stop $(docker ps -aq)

It will run stop for all.


Docker is a guardian angel in the DevOps working climate. With its various offices, it is probably the best apparatus that can be utilized to send various undertakings. It is the best stage to create, boat, and run various applications together.

Was this blog helpful?
You must be Logged in to comment
Code Block

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance