Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
- List of 20 docker commands and its use cases with example?
Docker version
We usually start by finding the installed version of docker that we are working on. Docker search
The “docker search” command searches for specific images through the Docker hub. This command returns the specific information, including image name, description, automated, official stars, etc. 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 ps
This command is used to list all the running containers in the background. 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 exec
This command is used to access the container that is running. 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 commit
This command is used to create or save an image of the edited container on the local system. Docker push
This command helps push or upload a docker image on the repository or the docker hub. Docker network
The ‘docker network’ command is used to know the details of the list of networks in the cluster. Docker rmi
This command is used to free up some disk space. The image id is used to remove the image while using this command. Docker ps -a
This command is used to know the details of all the running, stopped, or exited containers. Docker copy
This command copies a file from docker to the local system. Docker logs
This command is used to check the logs of all the docker containers with the corresponding contained id mentioned in the command. Docker volume
This command creates a volume so that the docker container can use it to store data. Docker logout
This command will log you out of the docker hub.