7. List of 20 docker commands and its use cases with example?

Docker ps
This command is used to list all the running containers in the background.

Docker ps -a
This command is used to know the details of all the running, stopped, or exited containers.

Docker version
We usually start by finding the installed version of docker that we are working on.

Docker pull
As the name suggests, this command pulls a specific image from the Docker Hub. All you have to do is use the command ‘docker pull’ along with the name of the image. Here is an example of pulling an image without using the tag.

Docker run
This command is used to create a container from an image.

Docker stop
The ‘docker stop’ command stops a container using the container name or its id.

Docker restart
This command is used to restart the stopped container. It is recommended to use this after rebooting the system.

Docker kill
This command is used to stop the container immediately by killing its execution. While the ‘docker stop’ command helps shut down the container in its own time, the ‘docker kill’ command stops it at once.

Docker login
This command helps you to log into your docker hub. As you try to log in, you will be asked to give your docker hub credentials.

Docker network
The ‘docker network’ command is used to know the details of the list of networks in the cluster.

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x