Docker is an open-source engine that automates the deployment of applications into containers.
Docker architecture:
- Docker uses a client/server architecture.
- "docker daemon" is server and responsible for build/run and distribute your docker containers.The user can not directly interact with the daemon, but instead through the Docker client.
- "docker" is a command line client binary which talks to docker daemon. It accepts commands from the user and communicates back and forth with a Docker daemon
- The Docker client and daemon communicate via sockets or through a RESTful API.
- Docker daemon and client can be run on same machine or two different machines.
NOTE: Single binary, docker, acts both as a server daemon and client.
Docker images:
- It is "build" component of docker. It can be considered as read-only templates for docker containers.
- Images are built step-by-step using a series of instructions like
a. ADD file
b. RUN command
c. Open port - You can build new images, updates existing one or download images which people already has created.
- You launch your containers from images.
Docker Registries:
- It is "distribution" component of Docker platform.
- You can have public/private registries.
- Public docker registry is provided with the Docker Hub. It serves a huge collection of existing images for your use.
- You can upload/download Docker images to/from these registries.
Docker Containers:
- It is "run" or "execution" component of docker.
- Containers are created from Docker images.
- You can create multiple containers from single image.
- Containers can be run, started, stopped, moved, and deleted.
- Each container is an isolated and secure application platform.
Summary:
- You can build a Docker images that hold your applications.
- You can create a docker containers from those Docker images to actually run your applications.
- You can share those Docker images via Docker Hub or your own registry.
How Docker images work?
- Each docker image starts from a base image (Ubuntu, Fedora etc).
- Further construction is done using simple, descriptive set of steps called instructions.
- Instructions are stored in a file called DockerFile. Docker reads this file and execute instructions to construct and returns the final image.
- Instruction include actions like ADD, COPY, RUN etc.
- Each instruction creates a new layer in our image.
- Docker makes use of Union File System to create the final image.
- That final image tells Docker what the container holds, what process to run when the container is launched, and a variety of other configuration data
How does container work?
- The Docker image is read-only. When Docker runs a container from an image, it adds a read-write layer on top of the image (using a union file system as we saw earlier) in which your application can then run.
No comments:
Post a Comment