Basic Docker Commands

Learn via video courses
Topics Covered

Docker is an open-source tool that streamlines application deployment through independent, portable containers, adaptable to both local and cloud environments. This separation of applications from infrastructure facilitates swift software delivery and uniform management practices. Docker commands are pivotal in containerization, empowering developers to construct, deploy, and manage applications efficiently. By encapsulating dependencies in self-contained units, these commands ensure consistent and reliable deployment. They enhance software management, fostering shorter development cycles, scalability, and portability across diverse environments. This concise guide illuminates the significance of Docker commands, offering a comprehensive list with illustrative examples for seamless application orchestration and deployment.

Basic Docker Commands

Let's take a look at the most commonly used docker commands.

docker - version

This docker command is used to output the currently installed version and build several dockers.

Example :

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data

docker pull

This docker command is used to pull images from a docker repository.

Example :

docker run

This docker command is used to start a docker container from a docker image.

Example :

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

docker ps

This docker command is used to output a list of containers currently running inside the docker engine.

Example :

docker ps -a

This docker command is used to output a list of containers currently existing inside the docker engine in the running or stopped state.

Example :

docker exec

This docker command is used to access a shell inside the running container.

Example :

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data

docker stop

This docker command is used to stop a running container.

Example :

docker restart

This docker command is used to restart a container Example :

docker kill

This docker command is used to terminate a container immediately.

Example :

'docker kill' and 'docker stop' perform the same action of terminating a container. But, ‘docker stop’ gives the container time to shut down gracefully, whereas 'docker kill' terminates a container immediately.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

docker commit

This docker command is used to create a new image of an edited container on the local system.

Example :

docker push

This docker command is used to push an image into a docker repository.

Example :

docker login

This docker command is used to login into a docker repository.

Example :

docker images

This docker command is used to list all the docker images stored on the machine.

Example :

docker rm

This docker command is used to delete a stopped container.

Example :

docker rmi

This docker command is used to delete a locally stored docker image.

Example :

docker build

This docker command is used to build a docker image based on the instructions specified in a Dockerfile.

Example :

Conclusion

We have taken a look over the most commonly used docker commands. Sound knowledge of these Docker commands will give you the needed expertise to work and experiment with Docker. So, practice them!

Let's continue learning about docker and its concepts with other docker-related articles.

Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more