7. List of 20 docker commands and its use cases with example?
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.
We usually start by finding the installed version of docker that we are working on.
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.
This command is used to create a container from an image.
The ‘docker stop’ command stops a container using the container name or its id.
This command is used to restart the stopped container. It is recommended to use this after rebooting the system.
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.
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.
The ‘docker network’ command is used to know the details of the list of networks in the cluster.