Docker is an open source software that simplifies the creation of containers and container–based applications. Originally developed for Linux, Docker now works on Windows and macOS as well. To understand how Docker works, you need to consider the components that are used to create containerized applications.
Managed DevOps
Dockerfile
Each Docker container starts with a Dockerfile, which is a text file that includes instructions for creating a Docker image. Dockerfile defines the operating system that will underlie the container, as well as languages, environment variables, file locations, network ports, and other necessary components and actions of the container after it is launched.
Docker image
After configuring the Dockerfile, the docker build utility is used to create an image based on it. While a Dockerfile is a set of instructions that tell a program how to create an image, a Docker image is a portable file containing specifications of software components running in a container. Since Dockerfile usually includes instructions for downloading some programs from online repositories, you must explicitly specify the current versions, otherwise Dockerfile may create incompatible images. Once the image is created, it cannot be changed (only add a new layer).
Docker run
Docker run is a command that searches for an image and launches a container based on it. Each container is based on an image. Containers are intended for temporary use, but they can be stopped and restarted, which will return the container to the same state in which it was stopped. In addition, several containers of the same image can be executed simultaneously (provided that each container has a unique name).
Docker Hub
Although it is easy to create containers, it is not necessary to make each image from scratch. Docker Hub is a SaaS repository for container sharing and management, where you can find official Docker images of open-source projects and vendors, as well as unofficial images. You can upload container images with useful code or upload your own to the Hub, making them public or private. You can also create a local Docker registry.
Docker Engine
The Docker Engine is the core of Docker, the underlying client-server technology that creates and runs containers. In general, when someone says “Docker” and doesn’t talk about their project, they mean Docker Engine. There are two different versions of Docker Engine: Docker Engine Enterprise (proprietary) and Docker Engine Community (public).