Top Docker Commands You Should Know



Top Docker Commands You Should Know


In my previous article, we already have learned what is docker its architecture and what is the difference between Docker and Kubernetes. In this article, we will discuss some of the frequently used docker commands along with its purpose.


Below is the list of most frequently used docker commands.





Docker Command
Purpose
docker --version
This command will give the installed docker version.

docker build <path to docker file>
This will build an image from a specified docker file.

docker pull <image name>
This will pull images from the docker repository.

docker create
This will create a new docker container.

docker run -it -d httpd

This will create a docker container in which the Apache HTTP server will run.
docker ps
This command will list the running containers.

docker ps-a
This will display all the docker containers running/exited/stopped with container details.

docker exec -it <container id> bash
This will access the docker container and run commands inside the container.

docker rm <container id>
This command will remove the docker container with container id mentioned in the command.

docker stop <container id>
This command will stop the running container.

docker rm <container id>
This command will remove the container for the mentioned container id.

docker rmi <docker image id>
This command will remove docker image for the provided docker image id.

docker kill <container id>

This command will kill running container.
docker restart <container id>
This command will restart the docker container with the provided container id.

docker start <container id>
This command will start the docker container for the provided container id.

docker stop <container id>
This command will stop the docker container for the provided container id.

docker login
This command will login into docker hub.

docker logout
This command will logout from docker hub.

docker rename <old container id> <new container id>

This command will rename the docker container from old to new container id.

docker pause <container id>
This command will pause the processes for the provided container id.

docker network ls
This command will list all the network in the coder cluster.

docker info
This command will display the system-wide information.

docker history <image name>
This command will list the history of docker image with the provided image id.

docker logs <container id>
This command will show the logs of the docker container with the provided container id.

docker search <image name>
This command will search the docker hub for the mentioned image name.

docker engine
This command will manage the docker engine.








SHARE THIS

Author:

My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post