Skip to main content

Command Palette

Search for a command to run...

Docker Command Line Interface (CLI) Demystified: A Step-by-Step Guide

Essential Docker Commands for Beginners: A Practical Guide .

Published
2 min read
H

Hii I'm Himanshu and I am a Full-Stack (MERN) developer and pre-final year student currently pursuing my b.tech in Computer Science. I would like to expand my knowledge in Tech currently I am learning about Indie hacking, Artificial Intelligence.

Docker Images :

docker images
  • List all images on the local system.
docker search
  • Search for Docker images on Docker Hub.
docker pull
  • Download a Docker image from Docker Hub or a private registry.
docker build
  • Build a Docker image from a Docker file.
docker tag
  • Add a new tag to an existing image.
docker rmi
  • Remove one or more Docker images from the local system.

Docker Containers


docker ps
  • List all running containers on the local system.
docker ps -a
  • List all containers on the local system, including stopped containers.
docker run
  • Start a new container from an image.
docker start
  • Start a stopped container.
docker stop
  • Stop a running container.
docker restart
  • Restart a running container.
docker rm
  • Remove one or more containers from the local system.
docker exec
  • Run a command inside a running container.
docker logs
  • Display logs from a container.

Docker Compose


docker-compose up
  • Start a multi-container application defined in a Docker Compose file.
docker-compose down
  • Stop and remove containers, networks, and volumes defined in a Docker Compose file.
docker-compose build
  • Build or rebuild services defined in a Docker Compose file.
docker-compose run
  • Run a one-off command on a service defined in a Docker Compose file.

Additionals


docker network
  • This command is used to manage Docker networks.
docker load
  • This command is used to load an image from a tar archive.
docker save
  • This command is used to save an image as a tar archive.
docker container prune -f
  • It will remove all the stopped containers from Docker.
docker rmi $(docker images -q)
  • Remove all the images at once.
docker inspect  [image_name]
  • It gives information on the image.

Thank you so much for taking your valuable time to read.

Any feedback for further improvement will be highly appreciated!

: )

#docker #cmd #devops