Faster, better AI-powered code reviews. Start your free trial!  
Faster, better AI-powered code reviews.
Start your free trial!

Get high quality AI code reviews

15 Essential Docker Commands Every User Should Know for Easy Container Management

38

Table of Contents

Essential Docker Commands

Here are 15 basic commands that every Docker user should know:

1. Docker Version: This command displays the version number of Docker that is currently installed on your system.

Docker Version

2. Docker Info: This command displays the detailed information about Docker, including the number of containers, images, and memory usage.

docker info

3. Docker Images: This command lists all the images available on your Docker system.

Docker Images

4. Docker Pull: This command downloads a specified image from Docker Hub or any other repository to your local system.

Docker Pull

5. Docker Run: This command starts a new container with the specified image.

docker run [image-name]

6. Docker Ps: This command lists all the running containers on your system.

Docker Ps

7. Docker Stop: This command stops a running container.

docker stop [container-name]

8. Docker Start: This command starts a stopped container.

docker start [container-name]

9. Docker Restart: This command restarts a running container.

docker restart [container-name]

10. Docker RM: This command removes a container from the system.

docker rm [container-name]

11. Docker Rmi: This command removes an image from the system.

docker rmi [image-name]

12. Docker Exec: This command allows you to execute commands in a running container.

docker exec [container-name] [command]

13. Docker Build: This command builds an image from a Dockerfile.

docker rmi [image-name]

12. Docker Exec: This command allows you to execute commands in a running container.

docker exec [container-name] [command]

13. Docker Build: This command builds an image from a Dockerfile.

docker build [path-to-dockerfile]

14. Docker Commit: This command creates a new image from a container’s changes.

docker commit [container-name] [image-name]

15. Docker Login: This command logs you into Docker Hub or any other registry.

docker login [registry-name]

These are the most commonly used Docker commands that every user should know. These commands will help you get started with it quickly and easily.

Now that you have a basic understanding of how to use some of the most common commands in Docker, let’s take a look at another important tool in the world of container orchestration: Kubernetes.

Kubernetes is a popular open-source container orchestrator that helps to deploy, scale, and manage many microservices. It uses a configuration file to automate the container management.

Major Commands in Kubernetes

1. kubectl create: This command creates a new resource in the cluster, such as a deployment, pod, or service.

kubectl create -f [filename]

2. kubectl get: This command retrieves information about resources in the cluster, such as pods, services, and nodes.

kubectl get [resource-type]

3. kubectl describe: This command provides detailed information about a specific resource, such as its state, events, and specifications.

kubectl describe [resource-type] [resource-name]

4. kubectl apply: This command updates existing resources in the cluster or creates new ones if they don’t exist.

kubectl apply -f [filename]

5. kubectl delete: This command deletes a resource from the cluster.

kubectl delete [resource-type] [resource-name]

6. kubectl logs: This command retrieves logs for a specific pod.

kubectl logs [pod-name]

7. kubectl exec: This command opens a shell inside a running container in a pod.

kubectl exec -it [pod-name] -- [command]

8. kubectl scale: This command changes the number of replicas for a deployment.

kubectl scale deployment [deployment-name] --replicas=[number-of-replicas]

8. kubectl rolling-update: This command updates an application with zero downtime by gradually replacing old pods with new ones.

kubectl rolling-update [deployment-name] -f [new-deployment.yaml]

9. kubectl port-forward: This command forwards traffic from a local port to a port in a pod.

kubectl port-forward [pod-name] [local-port]:[pod-port]

These are some of the major commands in Kubernetes that every user should know. With these commands, you can easily manage your applications and resources in a Kubernetes cluster.

Conclusion

In conclusion, both Docker and Kubernetes are important tools for managing containers and deploying applications. Docker is a platform for building, shipping, and running containers, while Kubernetes is a platform for automating deployment, scaling, and operations of containerized applications. Whether you are a beginner or an experienced user, these commands will help you to simplify your workflow and achieve your goals.

Stay tuned for our next post where we will provide a complete guide on how to use these commands and work with both Docker and Kubernetes. This guide will walk you through each command in detail and provide practical examples to help you get started with using these powerful tools for container orchestration.

Picture of Adhir Potdar

Adhir Potdar

Adhir Potdar, currently serving as the VP of Technology at Bito, brings a rich history of technological innovation and leadership from founding Isana Systems, where he spearheaded the development of blockchain and AI solutions for healthcare and social media. His entrepreneurial journey also includes co-founding Bord Systems, introducing a SaaS platform for virtual whiteboards, and creating PranaCare, a collaborative healthcare platform. With a career that spans across significant tech roles at Zettics, Symantec, PANTA Systems, and VERITAS Software, Adhir's expertise is a blend of technical prowess and visionary leadership in the technology space.

Picture of Amar Goel

Amar Goel

Amar is the Co-founder and CEO of Bito. With a background in software engineering and economics, Amar is a serial entrepreneur and has founded multiple companies including the publicly traded PubMatic and Komli Media.

Written by developers for developers

This article was handcrafted with by the Bito team.

Latest posts

Top 13 VS Code Extensions to become a JavaScript Wizard

Recent releases: Code Review Analytics, PR Changelists, Chain of Thought, and more

Bito’s AI Code Review Agent now available in VS Code and JetBrains extensions

PEER REVIEW: A New Video Podcast by Engineers, for Engineers

How Can AI Handle My Large Codebase?

Top posts

Top 13 VS Code Extensions to become a JavaScript Wizard

Recent releases: Code Review Analytics, PR Changelists, Chain of Thought, and more

Bito’s AI Code Review Agent now available in VS Code and JetBrains extensions

PEER REVIEW: A New Video Podcast by Engineers, for Engineers

How Can AI Handle My Large Codebase?

From the blog

The latest industry news, interviews, technologies, and resources.

Get Bito for IDE of your choice