Day 20 Task : Docker commands Cheat-Sheet

Docker commands:

docker build: Builds an image from a Dockerfile.

docker build [OPTIONS] PATH | URL | 

docker build -t <image_name> .        

docker run: Runs a command in a new container.

docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

docker run -d --name <container-name> -p 80:80 <image-name>        

docker start: Starts one or more stopped containers.

docker start <container-name>        

docker stop: Stops one or more running containers.

docker stop <container-name>        

docker pull: Pulls an image or a repository from a registry.

docker pull <image-name:tag>        

docker push: Pushes an image or a repository to a registry.

docker push <image-name:tag>        

docker exec: Runs a command in a running container and go inside a container.

docker exec -it <container-name or ID> bash        

docker rm: Removes one or more containers.

docker rm <container-name or ID>        

docker rmi: Removes one or more images.

docker rmi <image-name>        

docker images: Lists all the images on the local system.

docker images        

docker ps: Lists all running containers.

docker ps        

docker logs: Fetches the logs of a container.

docker logs <container-name or ID>        

docker inspect: Returns low-level information on a container or image.

docker inspect <container-name or ID>        

Docker Volume:

docker volume create: Create a volume

docker volume create <volume-name>        

docker volume ls : List volumes

docker volume ls        

docker volume inspect : Display detailed information on one or more volumes

docker volume inspect <volume-name>        

docker volume rm : Remove one or more volumes

docker volume rm <volume-name>        

docker volume prune : Remove all unused volumes

docker volume prune        

Docker Compose:

docker-compose up: Create and start containers

docker-compose up        

docker-compose ps: List containers

docker-compose ps        

docker-compose down: Stop and remove containers, networks, images, and volumes

docker-compose down        

docker-compose logs: Show logs

docker-compose logs <service>        

To view or add a comment, sign in

More articles by Deepika D

  • Day 28 Task: Jenkins Agents

    Jenkins Master (Server) Jenkins’s server or master node holds all key configurations. Jenkins master server is like a…

    4 Comments
  • Day 27 Task: Jenkins Declarative Pipeline with Docker

    Use your Docker Build and Run Knowledge docker build - you can use sh 'docker build . -t <tag>' in your pipeline stage…

    1 Comment
  • Day 26 Task: Jenkins Declarative Pipeline

    One of the most important parts of your DevOps and CICD journey is a Declarative Pipeline Syntax of Jenkins Some terms…

  • Day 24 Task: Complete Jenkins CI/CD Project

    Let's make a beautiful CI/CD Pipeline for your Node JS Application Task-01 Fork this repository: Create a connection to…

  • Day 23 Task: Jenkins Freestyle Project for DevOps Engineers.

    What is CI/CD? CI or Continuous Integration is the practice of automating the integration of code changes from multiple…

  • Day-22 : Getting Started with Jenkins

    1. What is Jenkins? Jenkins is an open source continuous integration-continuous delivery and deployment (CI/CD)…

  • Day 21 Task: Docker Important interview Questions.

    Docker Interview Docker is a good topic to ask in DevOps Engineer Interviews, mostly for freshers. One must surely try…

    6 Comments
  • Day 19 Task: Docker for DevOps Engineers

    Docker-Volume Docker allows you to create something called volumes. Volumes are like separate storage areas that can be…

    3 Comments
  • Day 18 Task: Docker for DevOps Engineers

    Docker Compose Docker Compose is a tool that was developed to help define and share multi-container applications. With…

  • Day 17 Task: Docker Project for DevOps Engineers.

    Dockerfile Docker is a tool that makes it easy to run applications in containers. Containers are like small packages…

Explore content categories