Homebreadcumb forward arrow iconBlogbreadcumb forward arrow iconFull Stack Developmentbreadcumb forward arrow iconDocker Cheat Sheet to Quicken App Development

Docker Cheat Sheet to Quicken App Development

Last updated:
27th May, 2020
Read Time
7 Mins
share image icon
In this article
Chevron in toc
View All
Docker Cheat Sheet to Quicken App Development

Working on Docker? You obviously can’t rely on your memory for the usual machine commands, and so, we present to you a comprehensive Docker cheat sheet.

Before working on Docker, it is important to become familiar with the associated terminology – Dockfires, images, etc. 

But first, let’s understand what Docker is and why it should be used.

Check out our free courses to get an edge over the competition

Ads of upGrad blog

What is Docker?

Also known as container manager, Docker is an open platform that helps developers develop and run applications.

But if Docker is a container manager, what is a container?

An environment in a capsule, running on shallow abstractions, meant for providing developers with virtual isolation to run processes without obstructions is called a container.

Docker is basically a place where you can manage these containers containing packaged software.

Check out upGrad’s Advanced Certification in Blockchain

Why use Docker?

Docker allows developers to build any kind of app in whichever language the client needs by using any toolchain that they prefer. Such apps are also portable and flexible to run anywhere, such as on Windows, Ubuntu, and Red Hat.

Since Docker tracks all the changes and manages them, it gets easier for the systems administrator to see how the app is being built and how it would work.

All in all, Docker is useful when you want to build high-quality apps faster.

Check out upGrad’s Advanced Certification in DevOps 

Learn more: Introduction to Docker Networking: Workflow, Networking

Explore Our Software Development Free Courses

Prerequisites for Working on Docker

1. Docker plugin along with zsh configuration manager to autocomplete Docker commands.

2. Linux – 3.10.x kernel or more

3. MacOS – 10.8 Mountain Lion or newer

Remember that after installing Docker, you need to check its version to know the features that are compatible with it. Here’s how you can find it out.

Use the command docker version to check the version of the Docker that you’re using.

Use the following command to know the server version.

$ docker version –format ‘{{.Server.Version}}’

Read: Docker Salary in India

Installing Docker

Here are links to install Docker on different operating systems.

Let’s now move on to container commands.

Explore our Popular Software Engineering Courses

Container Commands

What threads are to processes, containers are to virtual machines.

Here’s the chain of commands for different functions to perform on a container.


In order to keep the container running, use docker run -td container_id.

Starting and stopping containers

  • docker start nginx – to start a container
  • docker stop nginx – to stop a container
  • docker restart nginx – to restart a container
  • docker pause nginx – to pause a container
  • docker unpause nginx – to unpause a container
  • docker wait nginx – to block a container
  • docker kill nginx – to send a SIGKILL
  • docker attach nginx – to attach to one container to an existing container

upGrad’s Exclusive Software Development Webinar for you –

SAAS Business – What is So Different?


Image Commands in Docker

  • Creating an image from a Dockerfile: Docker build [URL], and Docker build -t for building an image from a Dockerfile in the current directory and tags the image
  • Pulling an image from a registry: Docker pull [IMAGE]
  • Pushing an image to a registry: docker push [IMAGE]
  • Creating an image from a tarball: docker import [URL/FILE]
  • Creating an image from a container: Docker commit [CONTAINER] [NEW_IMAGE_NAME]
  • Removing an image: Docker rmi [IMAGE]
  • Loading an image from a tar archive or stdin: docker load [TAR_FILE/STDIN_FILE]
  • Saving an image to a tar archive, streamed to STDOUT with all parent layers, tags, and versions: Docker save [IMAGE] > [TAR_FILE]

In-Demand Software Development Skills

Container and Image Information Commands

To manage the containers after setting them up, it is important to get all the relevant information out of them. Use to following commands to get image and container details in Docker.

  • docker ps – to list all the running containers
  • docker ps -a – to list both stopped and running containers
  • docker logs [CONTAINER] – to get all logs from a running container
  • docker inspect [OBJECT_NAME/ID] – to list low-level information on Docker objects
  • docker events [CONTAINER] – to list all real-time events in a container
  • docker port [CONTAINER] – to show the specific mapping of a container
  • docker top [CONTAINER] – to display all running processes
  • docker stats [CONTAINER] – to display usage statistics of a container in real-time
  • docker diff [CONTAINER] – to display all changed to a file or directory in a container
  • docker image ls – to list all locally stored images in the Docker engine
  • docker history [IMAGE] – to see the history of an image

Check out : 12 Interesting Docker Project Ideas For Beginners

Loading and Saving Images Commands in Docker

  • docker load < my_image.tar.gz – to load an image from a file
  • docker save my_image:my_tag | gzip > my_image.tar.gz – to save an existing image

Importing and Exporting Container

  • cat my_container.tar.gz | docker import – my_image:my_tag – to import a container as an image
  • docker export my_container | gzip > my_container.tar.gz – to export an existing container

Learn Software Development Courses online from the World’s top Universities. Earn Executive PG Programs, Advanced Certificate Programs or Masters Programs to fast-track your career.

Network Commands in Docker

1. To create a network, use the following command:

docker network create -d overlay MyOverlayNetworkdocker network create -d bridge MyBridgeNetworkdocker network create -d overlay \
  –subnet= \
  –subnet= \
  –gateway= \
  –gateway= \
  –ip-range= \
  –aux-address=”my-router=″ –aux-address=”my-switch=″ \
  –aux-address=”my-printer=″ –aux-address=”my-nas=″ \

2. To remove a network, use:

docker network rm MyOverlayNetwork

3. To list a network,

docker network ls

4. To get information about a network

docker network inspect MyOverlayNetwork

5. To connect a running container to a network

docker network connect MyOverlayNetwork nginx

6. To connect a container to a network when it starts

docker run -it -d –network=MyOverlayNetwork nginx

7. To disconnect a container from a network

docker network disconnect MyOverlayNetwork nginx

Also read: Docker Interview Questions & Answers

Ads of upGrad blog

Read our Popular Articles related to Software Development


This Docker cheat sheet should save you enough time while you’re working on building a high-quality app. Keep it handy at all times to quicken the process of app development! 

If you’re interested to learn more about docker, full stack software development , check out upGrad & IIIT-B’s PG Diploma in Full-stack Software Development which is designed for working professionals and offers 500+ hours of rigorous training, 9+ projects and assignments, IIIT-B Alumni status, practical hands-on capstone projects & job assistance with top firms.


Rohan Vats

Blog Author
Software Engineering Manager @ upGrad. Passionate about building large scale web apps with delightful experiences. In pursuit of transforming engineers into leaders.

Frequently Asked Questions (FAQs)

1Is Docker better than Virtual Machines (VM)?

Docker is an open platform container manager that enables developers and system coordinators to oversee the function of all the containers. It is accessible by any language and toolchain. Virtual Machines provide a software platform that developers use to go through an Operating System (OS). It utilizes an entire OS and has a singular non-shareable host kernel. Whereas in Docker, one OS can handle numerous workloads. Docker also allows one host kernel to be shared by multiple containers. In terms of storage space required, containers in Docker take up less space than Virtual Machines. Docker’s ability to operate from a single server gives it an upper hand over Virtual Machines. Hence, Docker is relatively better than Virtual Machines.

2How are Docker containers and images different?

Docker images and containers work with each other, which makes the functioning of Docker so optimal. They do vary in their origins and attributes. Docker images are the prototype or template through which Docker containers are reflected. Docker images are unchangeable; they provide a multi-layered structured template with guidelines for the container. This means that Docker containers cannot change by themselves unless their pre-existing Docker image is removed or updated. Since the image acts as a prototype, it’s made only once, while containers are producible for innumerable times. Docker images do not require containers to function, but containers are dependent on Docker images.

3Why are Kubernetes used with Docker?

Docker and Kubernetes collaborate to create scalable and functional application platforms. While Docker is excellent at intaking multiple containers and maintaining an Operating System, it does fall behind in running multiple containers independently and managing workloads significantly while scaling the containers across multiple servers. This is where Kubernetes can provide its expertise to ensure the smooth functioning of all the operations of Docker. It can handle vast containers and navigate their usage with specific users. So, while Docker focuses on containerization, Kubernetes provides orchestration of those containers.

Explore Free Courses

Suggested Blogs

Top 40 MySQL Interview Questions &#038; Answers For Beginners &#038; Experienced [2023]
Have a Data engineering or data science interview coming up? Need to practice some of the most asked MySQL interview questions? The article compiles t
Read More

by Rohan Vats

07 Nov 2023

Literals In Java: Types of Literals in Java [With Examples]
Summary: In this article, you will learn about Literals in Java. Literals in Java Integral Literals Floating-Point Literals Char Literals String Lit
Read More

by Rohan Vats

29 Oct 2023

10 Interesting HTML Project Ideas &#038; Topics For Beginners [2023]
Summary In this article, you will learn 10 Interesting HTML Project Topics. Take a glimpse below. A tribute page A survey form Technical documentati
Read More

by Rohan Vats

04 Oct 2023

15 Exciting SQL Project Ideas &#038; Topics For Beginners [2023]
Summary: In this Article, you will learn 15 exciting SQL project ideas & topics for beginners. Library Management System Centralized College Dat
Read More

by Rohan Vats

24 Sep 2023

17 Interesting Java Project Ideas &#038; Topics For Beginners 2023 [Latest]
Summary: In this article, you will learn the 17 Interesting Java Project Ideas & Topics. Take a glimpse below. Airline reservation system Data v
Read More

by Rohan Vats

24 Sep 2023

9 Exciting Software Testing Projects &#038; Topics For Beginners [2023]
Software testing might constitute 50% of a software development budget but it is viewed as a lethargic and unnecessary step by most students. Even edu
Read More

by Rohan Vats

21 Sep 2023

Top 10 Skills to Become a Full-Stack Developer in 2023
In the modern world, if we talk about professional versatility, there’s no one better than a Full Stack Developer to represent the term “versatile.” W
Read More

by Rohan Vats

21 Sep 2023

Java Free Online Course with Certification [2023]
The PYPL Popularity of Programming Language Index maintains that Java is the second most popular programming language in the world, after Python.  Alt
Read More

by Rohan Vats

20 Sep 2023

Salesforce Developer Salary in India in 2023 [For Freshers &#038; Experienced]
Wondering what is the range of salesforce salary in India? Businesses thrive because of customers. It does not matter whether the operations are B2B
Read More

by Rohan Vats

20 Sep 2023

Schedule 1:1 free counsellingTalk to Career Expert
footer sticky close icon