Register Now


Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Add question

You must login to ask a question.


Register Now

Lorem ipsum dolor sit amet, consectetur adipiscing elit.Morbi adipiscing gravdio, sit amet suscipit risus ultrices eu.Fusce viverra neque at purus laoreet consequa.Vivamus vulputate posuere nisl quis consequat.

Commonly Used Docker Commands Cheat Sheet

Cheat sheet for some commonly used Docker commands:

  1. docker run <image>: Starts a new container from the specified image.
  2. docker ps: Lists running containers.
  3. docker ps -a: Lists all containers (including those that are stopped).
  4. docker pull <image>: Pulls the specified image from DockerHub.
  5. docker stop <container_id>: Stops a running container.
  6. docker rm <container_id>: Removes a container. The container must be stopped first.
  7. docker images: Lists all images on your local system.
  8. docker rmi <image_id>: Removes an image.
  9. docker start <container_id>: Starts a stopped container.
  10. docker inspect <container_id>: Shows detailed information about a container.
  11. docker logs <container_id>: Shows the logs of a container.
  12. docker exec -it <container_id> /bin/bash: Opens a new shell inside an already running container.

Also Read: Powerful kubectl Commands for Kubernetes | Manage Resources, Interact with Clusters, Debug & More

  1. docker build -t <image_name> .: Builds a Docker image from a Dockerfile in the current directory.
  2. docker run -d <image>: Runs a container in detached mode (in the background).
  3. docker run -p <host_port>:<container_port> <image>: Starts a new container and forwards the specified port from the container to the host.
  4. docker run -v <host_dir>:<container_dir> <image>: Starts a new container and mounts the specified host directory into the container.
  5. docker commit <container_id> <new_image_name>: Creates a new image from a container's changes.
  6. docker login: Login to the DockerHub.
  7. docker push <username/image_name>: Pushes an image to DockerHub.
  8. docker tag <image_id> <username/image_name>: Tags an image with a new name.

This is not an exhaustive list of all Docker commands. There are many more commands and options available in Docker. Please refer to the Docker documentation for more detailed information:

Also Read: How to Set Up an EKS Cluster with eksctl command line

ALSO READ  How to setup kubectl on Macos/linux/Windows Operating system

About Abhay Singh

I'm Abhay Singh, an Architect with 9 Years of It experience. AWS Certified Solutions Architect.

Follow Me

Leave a reply