Docker Concepts
In this tutorial we will discuss about some of the concepts and terminology you’ll encounter when using Docker include the following
1. Dockerfile
- Developers use Dockerfiles to build container images, which then become the basis of running containers.
- A Dockerfile is a simple text file that contains instructions on how to build a docker image.
- A Dockerfile specifies the operating system that will underlie the container, along with the languages, environmental variables, file locations, network ports, and other components it needs—and what the container will do once we run it.
- When we build a docker file it should name as Dockerfile(case-sensitive)
- With a Dockerfile, the Docker daemon can automatically build a container image.
2. Docker Images
- A Docker image is containing everything needed to run an application as a container.
- Docker images contain executable application source code as well as all the tools, libraries, and dependencies that the application code needs to run as a container.
- When you run the Docker image, it becomes one instance (or multiple instances) of the container.
3. Docker Container
- A Docker container is a runtime instance of an image.
- From one image you can create multiple containers (all running the sample application) on multiple Docker platform.
- A container runs as a discrete process on the host machine. Because the container runs without the need to boot up a guest operating system it is lightweight and limits the resources (e.g. memory) which are needed to let it run.
4. Docker Hub
- Docker Hub is the public repository of Docker images that calls itself the “world’s largest library and community for container images.”
- It includes images that have been produced by Docker, Inc., certified images belonging to the Docker Trusted Registry, and many thousands of other images.
- All Docker Hub users can share their images at will. They can also download predefined base images to use as a starting point for any containerization project.
- Docker Hub has a set of official images that are certified by Docker. These are images from known software publishers such as Canonical, Red Hat, and MongoDB. You can use these official images as a basis for building your own images or applications.
5. Docker Registry
- A Docker registry is a place where container images are published and stored.
- The Registry can be either a user’s local repository or a public repository like a Docker Hub allowing multiple users to collaborate in building an application.
- It can be public, so everyone can use it, or private, restricted to an organization or a set of users.
- A Docker registry comes with a set of common APIs that allow users to build, publish, search, download, and manage container images.
Above picture depicts a workflow in which a user constructs an image and uploads it to the registry. Other users can pull the image from the registry to make production containers and deploy them to Docker hosts, wherever they are.
6. Docker Daemon
- Also known as the Docker Engine.
- Docker Daemon is the background service running on the host that manages the building, running, and distributing Docker containers.
- The daemon is the process that runs in the operating system in which clients speak.
- Docker daemon is a thin layer between the containers and the Linux kernel.
- Any Docker container can run on any server that is Docker-daemon enabled, regardless of the underlying operating system.
7. Docker Compose
- Docker-compose is for running multiple containers as a single service.
- It does so by running each container in isolation but allowing the containers to interact with one another.
- With Docker compose, you use a YAML file to configure your application’s services.
- Docker Compose to manage the orchestration of multi-container applications.
- When working with multiple containers, it can be difficult to manage the starting along with the configuration of variables and links. To solve this problem, Docker has a tool called Docker Compose
- Docker Compose supports all of the properties which can be defined using docker run.
8. Docker Swarm
- Docker swarm is a service for containers that allows IT administrators and developers to create and manage a cluster of swarm nodes within the Docker platform.
- Each node of Docker swarm is a Docker daemon, and all Docker daemons interact using the Docker API.
- A swarm consists of two types of nodes: a manager node and a worker node.
- A manager node maintains cluster management tasks. Worker nodes receive and execute tasks from the manager node.
Docker Concepts