In my previous blogs, I’ve covered what Docker is and how you can use it. Today, in this blog, I’ll talk about the 15 best Docker commands you’ll use frequently while working with Docker. The Docker container trend has been growing irrepressibly with organizations actively looking for professionals who possess Docker certification training and a solid knowledge of these Docker commands will give you the necessary expertise.
The following are the commands being covered:
docker -version docker pull docker run docker ps docker
- ps -a
- docker push
docker exec docker stop docker kill docker
of Docker Docker RM Docker
Docker So, let’s get started:Docker commands 1. docker -version This command is used to get the currently installed version of Docker
<img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/Docker_Version-Docker-Commands-Edureka-3-e1510653973130.png” alt=”Docker_Version – Docker Commands – Edureka” />3. Running Docker
Usage: docker run -it -d
This command is used to create a container from an image
<img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/Docker_Pull-Docker-Commands-Edureka-2-e1510653950923.png” alt=”Docker_Pull – Docker commands – Edureka” />4. Docker PS
This command is used to enumerate
running containers 5 commands. Docker PS-A
This command is used to display all
running and exited containers <img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_ps-Docker-Commands-Edureka-e1510653881541.png” alt=”docker_ps – Docker – Edureka” />6 commands.
Usage: docker exec -it <container id> bash
This command is used to access the running container
<img src=” https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_psa-Docker-Commands-Edureka-e1510653854892.png” alt=”docker_psa – Docker Commands – Edureka” />7. Docker stop
Usage: docker stop
This command stops a running container
<img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_exec-Docker-Commands-Edureka-e1510653829237.png” alt=”docker_exec – Docker Commands – Edureka” />8. Kill Docker
Usage: docker kill <container id>
This command kills the container by stopping its execution immediately. The difference between ‘docker kill’ and ‘docker stop’ is that ‘docker stop’ gives the container time to shut down properly, in situations where it takes too long to stop the container, you can choose to kill it
9. Docker Confirmation
Usage: docker commit <conatainer id> <username/imagename>
This command creates a new image of an edited container on the local system
<img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_kill-Docker-Commands-Edureka-e1510653772661.png” alt=”docker_kill – Docker Commands – Edureka” />10. Docker login
This command is used to log in to the docker hub<
img repository src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_commit-Docker-Commands-Edureka-e1510653734760.png” alt=”docker_commit – Docker Commands – Edureka” />11.
docker push Usage: docker push
This command is used to push an image to the
docker hub repository
<img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_login-Docker-Commands-Edureka-1-e1510653706645.png” alt=”docker_login – Docker – Edureka commands” />12. Docker
This command lists all
locally stored Docker images <img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_push-Docker-Commands-Edureka-e1510653678749.png” alt=”docker_ push – Docker Commands – Edureka” />13. Using Docker RM:
docker rm <container id
This command is used to delete a stopped container
<img src=” https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_images-Docker-Commands-Edureka-e1510653647888.png” alt=”docker_images – Docker Commands – Edureka” />14. Docker RMI
Usage: docker rmi <image-id
This command is used to delete an image from local storage
<img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_rm-Docker-Commands-Edureka-e1510653622699.png” alt=”docker_rm – Docker Commands – Edureka” />15. Building Docker
docker build <path to docker file>
This command is used to construct an image from a
specified docker file
<img src=”https://d1jnx9ba8s6j9r.cloudfront.net/blog/wp-content/uploads/2017/11/docker_rmi-Docker-Commands-Edureka-e1510653592230.png” alt=”docker_rmi – Docker Commands – Edureka” />
Want to learn more about docker commands? Here’s a Docker tutorial to get you started. Alternatively, you can take a top-down approach and get started with this Devops tutorial.
Now that you’ve understood what DevOps is, check out our DevOps certification training from Edureka, a trusted online learning company with a network of over 250,000 satisfied learners spread across the globe. The Edureka DevOps certification training course helps students gain experience in various DevOps processes and tools such as Puppet, Jenkins, Nagios, Ansible, Chef, Saltstack, and GIT to automate multiple steps in SDLC.
Do you have a question for us? Please mention it in the comments section and we will contact you.