DEV Community

Cover image for Docker Cheat Sheet
Ankush Singh Gandhi
Ankush Singh Gandhi

Posted on • Updated on

Docker Cheat Sheet


What is Docker🔽

Docker is an open-source project for automating the deployment of applications as portable, self-sufficient containers that can run on the cloud or on-premises. Docker is also a company that promotes and evolves this technology, working in collaboration with cloud, Linux, and Windows vendors, including Microsoft.


Docker containers can run anywhere, on-premises in the customer datacenter, in an external service provider or in the cloud, on Azure. Docker image containers can run natively on Linux and Windows. However, Windows images can run only on Windows hosts and Linux images can run on Linux hosts and Windows hosts.

⭐⭐Support me here so that i can provide more usefull content⭐⭐
And visit for more usefull content

Buy Me A Coffee

Developers can use development environments on Windows, Linux, or macOS. On the development computer, the developer runs a Docker host where Docker images are deployed, including the app and its dependencies. Developers who work on Linux or on macOS use a Docker host that is Linux based, and they can create images only for Linux containers.


Containers include the application and all its dependencies. However, they share the OS kernel with other containers, running as isolated processes in user space on the host operating system.

A simple analogy🔽

In Docker, each layer is the resulting set of changes that happen to the filesystem after executing a command, such as, installing a program.

So, when you "look" at the filesystem after the layer has been copied, you see all the files, included the layer when the program was installed.

You can think of an image as an auxiliary read-only hard disk ready to be installed in a "computer" where the operating system is already installed.

Similarly, you can think of a container as the "computer" with the image hard disk installed. The container, just like a computer, can be powered on or off.

Docker terminology🔽

Container image:

A package with all the dependencies and information needed to create a container. An image includes all the dependencies (such as frameworks) plus deployment and execution configuration to be used by a container runtime. Usually, an image derives from multiple base images that are layers stacked on top of each other to form the container's filesystem. An image is immutable once it has been created.


A text file that contains instructions for building a Docker image. It's like a batch script, the first line states the base image to begin with and then follow the instructions to install required programs, copy files, and so on, until you get the working environment you need.


The action of building a container image based on the information and context provided by its Dockerfile, plus additional files in the folder where the image is built. You can build images with the following Docker command:

docker build
Enter fullscreen mode Exit fullscreen mode


An instance of a Docker image. A container represents the execution of a single application, process, or service. It consists of the contents of a Docker image, an execution environment, and a standard set of instructions. When scaling a service, you create multiple instances of a container from the same image. Or a batch job can create multiple containers from the same image, passing different parameters to each instance.


Offer a writable filesystem that the container can use. Since images are read-only but most programs need to write to the filesystem, volumes add a writable layer, on top of the container image, so the programs have access to a writable filesystem. The program doesn't know it's accessing a layered filesystem, it's just the filesystem as usual. Volumes live in the host system and are managed by Docker.


A mark or label you can apply to images so that different images or versions of the same image (depending on the version number or the target environment) can be identified.

Repository (repo):

A collection of related Docker images, labeled with a tag that indicates the image version. Some repos contain multiple variants of a specific image, such as an image containing SDKs (heavier), an image containing only runtimes (lighter), etc. Those variants can be marked with tags. A single repo can contain platform variants, such as a Linux image and a Windows image.


A service that provides access to repositories. The default registry for most public images is Docker Hub (owned by Docker as an organization). A registry usually contains repositories from multiple teams. Companies often have private registries to store and manage images they've created. Azure Container Registry is another example.

Docker Hub:

A public registry to upload images and work with them. Docker Hub provides Docker image hosting, public or private registries, build triggers and web hooks, and integration with GitHub and Bitbucket.

Docker daemon:

Runs on host machine creates and manages docker objects such as images, containers, network, volume, data, etc.

Docker client:

UI for docker which accepts commands from user and communicate with docker host.

Docker taxonomy🔽


When using Docker, a developer creates an app or service and packages it and its dependencies into a container image. An image is a static representation of the app or service and its configuration and dependencies.

To run the app or service, the app's image is instantiated to create a container, which will be running on the Docker host. Containers are initially tested in a development environment or PC.

The registry is like a bookshelf where images are stored and available to be pulled for building containers to run services or web apps. There are private Docker registries on-premises and on the public cloud. Docker Hub is a public registry maintained by Docker.

Docker commands🔽

🌟Concept of Docker:

  • Build image
  • Ship image
  • Run image

🌟Docker Service:

First we have to start the docker daemon by

service docker start

To view status of the service use this command

service docker status

To stop service use this command

service docker stop

NOTE ~ if Docker was unable to find image on machine it will try to find on DockerHub

🌟Run an Image:

Run an image(hello-world) from DockerHub

docker run hello-world

hello-world is an image. we just made container from it. It will first try to find this image locally then on repository. Default repository is DockerHub

To check existing images

docker image ls

We can pull images from registry without making container of it with this command

docker pull hello-world


⭐⭐Support me here so that i can provide more usefull content⭐⭐
And visit for more usefull content

Buy Me A Coffee

My other Blogs

Top comments (2)

ankushsinghgandhi profile image
Ankush Singh Gandhi

😃 😃