What is Docker?
Docker is an open-source containerization software used to bundle applications into containers that can be packaged and run anywhere. Docker is often used for application development, deployment, and management environment for containers. A common use case for Docker would be hosting your application as a web app or running tests on your CI/CD pipeline.
Often when a developer creates an application or script, they are able to run the application on their local machine but it might fail on a server or another machine. This brings up the age-old problem of, “Why does it run on my machine but not others?” Docker was created expressly to solve this issue and operates on all platforms.
So what is a container?
This can be best answered by documentation from Docker itself:
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings [1].
This image above might remind you of OSI's 7 layers of networking image and we can draw comparisons between the two.
How does it work?
Docker used client-server architecture which allows the client to talk to the Daemon. The Daemon does a lot of the heavy lifting to build, run and distribute containers. The two components communicate through a REST API over Unix sockets or another network interface. If you are running a set of containers then the Docker compose client is used to communicate with the Daemon. Docker is often compared to virtual machines but there are some large differences. A virtual machine is not built on container technology and Docker containers share the host's OS kernel.
What makes Docker containers special?
They are incredibly strong, densely packed, and include several different components. Your code, dependencies, configurations, processes, networking, and a portion of the operating systems that are in charge of modifying various aspects of your code are all crammed into these containers. [2] It might help to look at the image below of the different components of docker and how your use case might benefit from these.
Components of Docker
The Docker daemon:
The daemon (dockerd) listens for API requests and handles images, containers, networks, and volumes.
The Docker client:
This is what most users will interact with, calling functions like docker run
will communicate though API with the Daemon to actually do the heavy lifting. A single client can communicate with multiple daemons.
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.
When you use the docker pull
or docker run
commands, the required images are pulled from your configured registry. When you use the docker push
command, your image is pushed to your configured registry. [3]
Top Benefits of docker:
Rapid deployment:
Docker offers repeatable environments for development, building, testing, and production. You can version control and commit changes to your Docker images using Docker, and engineers can better identify and address application bugs due to this. Additionally, Docker is rapid, making it simple to create replications and establish redundancy.
Portability:
Once your containerized application has been tested, you may deploy it to any other system that is running Docker and be confident that it will function the same as it did during testing.
Security:
One of the main advantages of Docker is security. It ensures that any application running in a container is totally isolated from every other application, giving you whole control over traffic flow and administration and separation from other applications.
Drawbacks of Docker:
Missing features:
Since Docker is still in development and relatively new at the time of writing this, there are a ton of feature requests are under progress, like container self-registration, and self-inspects, copying files from the host to the container, and many more.
Data Availability:
If a container goes down while running something, it needs a backup and recovery strategy, although there are several solutions, that are neither automated nor very scalable yet.
If you enjoyed this, please like and follow for more!
To join medium use my link below: https://colecrescas.medium.com/membership
[1] https://www.docker.com/resources/what-container/
[2] https://www.infosectrain.com/blog/what-is-docker-and-its-benefits/