Docker Orchestrationš³š
For you programmers out there, have you heard about container and images? What about docker? If you are reading this right now, you probably found this article while searching for how to implement container using docker to your application, well you are in the right place! Here we will learn about what docker is and what benefit can it bring to your application.
What is Docker?
Docker is an open platform with the purpose of helping developers in developing, shipping, and running their application. To do this, Docker uses containers which allows us to package our application alongside its libraries and dependencies into these containers. By using these containers we can avoid the problem where the application can be run in one environment but is unable to run in another environment because it doesnāt have the dependencies required to run the program. Docker enables us to separate the applications from the infrastructure so we can deliver software quickly.
Docker Terms
DockerFile
DockerFile is a text file that contains the instructions for how to build the Docker container image. These instructions will be the commands that the Docker Engine will run to create the image.
Docker images
Docker images are read-only files which contain the executable application source code and all the libraries and dependencies that the application needed in order to run. When you run the Docker image, it becomes one instance (or multiple instances) of the container. Whenever we make some changes to the image, that image will replace the previous image and become the current version of the image.
Docker containers
Docker containers are the running instances of Docker images. Users can interact with them, such as starting, stoping, or deleting a container using the Docker API or CLI. A container depends on the image and configurations we provided when we start it.
Docker Hub
Docker Hub is the public repository of Docker images. All the Docker Hub users can share their images in here and they can also download base images to be used in their development.
Docker Architecture
Docker architecture implements the client-server model. Docker architecture has several components which mainly consist of 3 components, which is Docker daemon, Docker client, and Docker registry.
- Docker Daemon: listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes.
- Docker Client (CLI): a facility used by the users to trigger docker commands, the commands will be sent to the daemon.
- Docker Registry: is a registry for storing docker images, if not configured, the Docker will pull from images in the Docker Hub.
The Docker client can connect to either a remote Docker daemon or a Docker daemon that is run on the same system as the client. The Docker clientās job is to communicate with the Docker daemon through REST API, which will then build, run, and distribute the Docker containers.
What are The Benefits of Using Docker?
Here are some of the benefits that we get if we implement Docker:
1. Isolated Environment, Consistency, and Portability
With Docker, we can make sure that our application works in others machine, not just ours, this is because the container already has all the libraries and dependencies needed to run the application. Containers also enable us to create a predictable and consistent environment that is isolated from other applications.
2. Efficient Use of System Resources
Docker containers need less memory than a virtual machine, which leads us to be able to reduce the cost spent by us. Its small memory also results in containers starts up and stops more quickly.
3. Performance
Because Docker runs on a shared operating system rather than its own operating system, it is faster to create, quicker to start, and overall more efficient compared to creating a virtual machine.
4. Modularity and Scaling
Docker enables us to segment our application so you can refresh, clean up, repair without the need to take down the whole application entirely. Additionally, Docker enables us to build an architecture for applications comprising of small processes that communicate with each other via APIs.
5. Roll Back
Docker images are easy to be versioned, which makes it easy for us to roll back if whenever we need it. When we encounter a problem in the current iteration of the image, we can just roll back to the older version where the problem doesnāt exist.
When to Not Use Docker?
Interestingly enough, there are some circumstances where using Docker is not recommended, below are some of those circumstances:
1. Do Not Use Docker if You Need to Use Different Operating Systems or Kernels
Docker images require the same operating system it was created for, therefore ff an app is developed on Windows, but the production runs on Linux, you will not be able to use Docker effectively.
2. Do Not Use Docker if You Are Looking for The Easiest Technology to Manage
Docker is still a new technology and still growing, which makes the documentation for its features might not be complete, which means we might have to figure some things out ourself. Furthermore if our application is complex and large, building and maintaining communications between a lot of containers might need extra time and effort.
3. Do Not Use Docker if You Develop a Desktop GUI Application
Docker is intended for isolated containers with console-based applications and is not suitable for applications with rich user interfaces. Additionally, Windows container does not allow users to start up a GUI-based interface in the Docker container.
4. Do Not Use Docker if You Want to Light Up Development and Debugging
If we want to use Docker, we will have to do some extra setup to code our application in Docker. If the application you want to develop is considered a simple application, it is not recommended for you to use Docker since it will only add unnecessary complexity to your application.
Thank you for reading, hope you have a great day!