Top Docker Commands You Should Know

Top Docker Commands You Should Know

10 Sep 2025
Beginner
1.05K Views
8 min read
Learn with an interactive course and practical hands-on labs

Free Docker Online Course with Certificate - Beginner Level

Docker is a modern containerization platform that enables developers to build, ship, and run applications in isolated environments. Docker simplifies application deployment by packaging everything needed to run an application, ensuring consistency across different environments. Big companies rely on Docker for its efficiency, scalability, and seamless integration with CI/CD pipelines.

Hence, in this Docker Commands Guide, we will explore essential Docker commands, how they work, and their role in managing containers effectively.

Master Docker without spending money. Join our Free Docker Online Course and earn a certificate that proves your skills.

What is Docker?

Docker is an open-source platform that helps developers build, package, and deploy applications using containers. Containers are lightweight, portable, and ensure applications run consistently across different environments. Docker eliminates compatibility issues by packaging applications with their dependencies. Docker simplifies deployment and is widely used in DevOps, cloud computing, and CI/CD pipelines.

Read More: Free Docker Online Course with Certificate - Beginner Level

What does Docker do?

Docker helps you build, package, and run applications using containers. Docker makes sure your apps work the same way everywhere by including everything they need to run. With Docker, you can deploy faster, use resources better, and scale easily, making it a great tool for DevOps, microservices, and cloud computing.

Docker Commands

1. docker --version

  • This command is used to check the installed Docker version.
  • It helps verify if Docker is correctly installed on the system.
  • It displays the version of the Docker client installed on the machine.
  • Useful for troubleshooting compatibility issues with Docker images or commands.

2. docker pull

  • This command is used to download a Docker image from a registry like Docker Hub.
  • It ensures you have the latest or specified version of an image.
  • It supports pulling multiple architectures based on the host system.
  • Useful for setting up new environments quickly without manual downloads.

3. docker run

  • This command is used to create and start a new container from a specified image.
  • It allows passing environment variables, ports, and configurations during execution.
  • Supports detached mode (`-d`) for background execution.
  • Can automatically remove the container after execution using `--rm`.

4. docker ps

  • This command is used to list all running Docker containers.
  • It shows container IDs, names, statuses, and other details.
  • Supports filtering with `--filter` to list specific containers.
  • Using `--format` allows custom output for scripting purposes.

5. docker ps -a

  • This command is used to list all Docker containers, including stopped ones.
  • It helps track container history and troubleshoot stopped instances.
  • Provides timestamps for when containers were created and exited.
  • Supports sorting containers using `--sort`.

6. docker exec

  • This command is used to run commands inside an already running container.
  • It is useful for debugging or interacting with containerized applications.
  • Allows running interactive sessions using `-it`.
  • Supports executing scripts and commands without opening a shell.

7. docker stop

  • This command is used to stop a running container gracefully.
  • It allows the container to exit safely before termination.
  • Ensures application shutdown processes are executed.
  • Can accept multiple container IDs or names at once.

8. docker kill

  • This command is used to forcefully stop a running container.
  • It immediately terminates the container without a graceful shutdown.
  • Supports sending specific signals to a container using `--signal`.
  • Useful for emergency container shutdowns.

9. docker commit

  • This command is used to create a new image from an existing container.
  • It captures the container's current state as a reusable image.
  • Allows adding commit messages for better tracking.
  • Supports changing metadata such as environment variables during commit.

10. docker login

  • This command is used to authenticate a user with a Docker registry.
  • It is required before pushing images to a private or public registry.
  • Stores credentials securely for future use.
  • Supports logging into self-hosted Docker registries.

11. docker push

  • This command is used to upload a Docker image to a registry.
  • It allows sharing images with teams or deploying to cloud environments.
  • Requires authentication before pushing to a private registry.
  • Supports pushing multiple tags of an image at once.

12. docker images

  • This command is used to list all locally available Docker images.
  • It displays image IDs, tags, sizes, and creation dates.
  • Supports filtering by repository or tag.
  • Shows dangling images that might need cleanup.

13. docker rm

  • This command is used to remove one or more stopped containers.
  • It helps free up system resources by deleting unused containers.
  • Supports force removal with `-f`.
  • Can remove multiple containers at once using space-separated IDs.

14. docker rmi

  • This command is used to remove one or more Docker images.
  • It clears up disk space by deleting unused or old images.
  • Requires removing associated containers before deleting an image.
  • Supports force deletion with `--force`.

15. docker build

  • This command is used to create a new Docker image from a Dockerfile.
  • It automates the process of defining and packaging containerized applications.
  • Supports multi-stage builds for optimizing image size.
  • Can specify a custom Dockerfile using `-f`.

32. docker system df

  • This command is used to show disk space usage by Docker images, containers, and volumes.
  • It helps analyze storage consumption and optimize resource management.
  • Supports identifying unused Docker resources.
  • Helps free up space using `docker system prune`.
Conclusion
Docker's command-line interface (CLI) provides a powerful and flexible way to interact with containers, making it easier to ensure consistency across development, testing, and production environments. By mastering these commands, developers can leverage Docker's full potential to improve scalability, portability, and efficiency in modern software development workflows. If you want to master Docker just go forDocker and Kubernetes Certification Training.

If you want to master Docker, explore options like a Docker Course Free or go for a comprehensive Docker and Kubernetes Certification Training.

FAQs

There are some basic docker commands:
  • is lists the resources.
  • cp copies files/folders between the container and the local file system.
  • create creates a new container.
  • diff inspects changes to files or directories in a running container.
  • logs fetches the logs of a container

The Docker top command provides information about the CPU, memory, and swap usage if you run it inside a Docker container.

​The docker run command starts a new container, executes a command inside it, and pulls an image if needed. You can use the Docker run command to create and execute containers based on Docker images

Docker is a platform that helps developers build, test, and deploy applications in containers. Docker containers are standardized units that contain everything needed to run an application
What Docker is used for
  • Rapid application development: Docker helps developers build and test applications faster. 
  • Application portability: Docker containers can run consistently across different environments, including on different servers. 
  • Application isolation: Docker containers provide an isolated environment for each application, which can help improve security and manageability

Docker and Kubernetes are both open-source technologies that help developers build and manage containerized applications. Docker is used to create containers, while Kubernetes is used to manage and scale those containers. 

Take our Docker skill challenge to evaluate yourself!

In less than 5 minutes, with our skill challenge, you can identify your knowledge gaps and strengths in a given skill.

GET FREE CHALLENGE

Share Article
About Author
Shailendra Chauhan (Microsoft MVP, Founder & CEO at ScholarHat)

He is a renowned Speaker, Solution Architect, Mentor, and 10-time Microsoft MVP (2016–2025). With expertise in AI/ML, GenAI, System Design, Azure Cloud, .NET, Angular, React, Node.js, Microservices, DevOps, and Cross-Platform Mobile App Development, he bridges traditional frameworks with next-gen innovations.

He has trained 1 Lakh+ professionals across the globe, authored 45+ bestselling eBooks and 1000+ technical articles, and mentored 20+ free courses. As a corporate trainer for leading MNCs like IBM, Cognizant, and Dell, Shailendra continues to deliver world-class learning experiences through technology & AI.
Live Training - Book Free Demo
Azure DevOps Certification Training
24 Sep
08:30PM - 10:30PM IST
Checkmark Icon
Get Job-Ready
Certification
Accept cookies & close this