Welcome to CloudAffaire and this is Debjeet.
In this series, we will explore one of the most popular containerization tool Docker. We will try to cover each aspect of docker with a demo.
What is Docker?
Docker is a platform for developers and sysadmins to develop, deploy, and run applications with containers. The use of Linux containers to deploy applications is called containerization. Containers are not new, but their use for easily deploying applications is.
Benefits of containerization:
- Flexible: Even the most complex applications can be containerized.
- Lightweight: Containers leverage and share the host kernel.
- Interchangeable: You can deploy updates and upgrades on-the-fly.
- Portable: You can build locally, deploy to the cloud, and run anywhere.
- Scalable: You can increase and automatically distribute container replicas.
- Stackable: You can stack services vertically and on-the-fly.
Docker Engine is a client-server application with these major components:
- A server which is a type of long-running program called a daemon process (the dockerd command).
- A REST API which specifies interfaces that programs can use to talk to the daemon and instruct it what to do.
- A command line interface (CLI) client (the docker command).
Docker core components:
- The Docker daemon: The Docker daemon (dockerd) listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. A daemon can also communicate with other daemons to manage Docker services.
- The Docker client: The Docker client (docker) is the primary way that many Docker users interact with Docker. When you use commands such as docker run, the client sends these commands to dockerd, which carries them out. The docker command uses the Docker API. The Docker client can communicate with more than one daemon.
- Docker registries: A Docker registry stores Docker images. Docker Hub is a public registry that anyone can use, and Docker is configured to look for images on Docker Hub by default. You can even run your own private registry.
- Docker objects: When you use Docker, you are creating and using images, containers, networks, volumes, plugins, and other objects. Below are some of the docker objects.
- Images: An image is an executable package that includes everything needed to run an application–the code, a runtime, libraries, environment variables, and configuration files. Docker uses images to run a container.
- Container: A container is a runtime instance of an image, what the image becomes in memory when executed.
- Services: Services allow you to scale containers across multiple Docker daemons, which all work together as a swarm with multiple managers and workers. Each member of a swarm is a Docker daemon, and the daemons all communicate using the Docker API.
- Network: Network serves as a backbone of docker and enables communication between host, containers and remote. When you install Docker, it creates three networks automatically.
- Volume: Volumes are the preferred mechanism for persisting data generated by and used by Docker containers. While bind mounts are dependent on the directory structure of the host machine, volumes are completely managed by Docker.
Hope you have enjoyed this article. In the next blog post, we will discuss how to install docker in AWS EC2 instance.
To get more details on docker, please refer below docker documentation