Are you a developer? And are you worried about the system that will be running on? Take a deep breath and calm down, use the ✨Docker✨
What is Docker?
Docker is a tool designed to make it easy to build, deploy, and run applications using containers. The container allows the developer to package the application with all its parts, such as libraries and other dependencies, and implement it as a single package. This means that developers can focus on writing code without worrying about the system that will eventually run it. It also allows them to start by using one of the thousands of programs already designed to run in Docker containers as part of their application.
What is Container?
Container is an OS virtualization that can wrap an application with its dependencies and environment. Each of these containers has an isolated process so that it doesn’t interfere with the host OS or other containers. Containers provide a highly efficient and highly detailed mechanism for combining software components into application types to keep those software components updated and maintained.
How to use Docker?
Here are several steps that must be passed.
- Docker Image
the file that contains guides and information for building a container.
environment or environment for application packaging needs that include system tools, code, runtime, and configuration.
- Docker Client
a place where users can send commands such as the Docker run, pull, and build to the Docker Daemon.
- Docker Host
responsible for receiving commands from the Docker Client
- Docker Engine Rest API
used for interaction with the Docker Daemon
- Docker Hub
a service that allows sharing Container Image with the team.
- Docker Daemon
responsible for managing Docker Image, Container, Storage Volume and Network.
- Docker Registry
a place to store the Docker image which will give the output according to the given command.
Docker uses a client-server architecture. The Docker client talks to the Docker daemon, which does the heavy lifting of building, running, and distributing your Docker containers. Docker clients and daemons communicate using the REST API, via a UNIX socket or network interface. The Docker client and daemon can run on the same system, or you can connect the Docker client to a remote Docker daemon. Another Docker client is Docker Compose, which lets you work with applications that are composed of a collection of containers.
The Docker daemon will execute commands by managing objects such as images, containers, etc.
In PPL projects, my team uses docker to make our work easier. The first step I did was to install the Docker Client. What we need to do next is to create a Dockerfile. Here is the Dockerfile in our PPL project.
The command beside basically tells docker to :
FROM— Create an image from a Python 3.8 image
WORKDIR— Change the working directory to $DockerHOME
ENV— Set the environment variables
RUN— Install dependencies
COPY— Copy the whole project to docker home directory
EXPOSE— Port where the Django app runs
Next up is Dockerfile.web which sets up the environment and ensures that the Heroku container will do the python commands (makemigrations, migrate, and then runserver).
Update your GitLab configuration to include the docker image. Below is an example of our GitLab configuration for a docker image.
There are common functions that Docker has:
1. Supporting Developer Productivity
The first function is to be able to support performance in carrying out the stages of product application development effectively and achieve optimal production targets. The use of this platform makes it easier to run multiple services at once and is suitable for working on medium to upper-scale projects.
2. Simple Configuration Stage
Docker has the same advantages as virtual machines in general but does not take up the overhead. The existence of a simple configuration process in many environments is able to separate the infrastructure requirements for these applications.
3. Enable Portability
Docker containers run on any machine that supports a container runtime environment so that the application environment and the underlying operating environment can be kept clean and minimal. You can easily move container-based applications from the system to the cloud environment.
Docker is a platform that functions as an open-source container to accommodate various types of applications in one place. The main function of using Docker is to help increase the productivity and work effectiveness of developers in building quality products. The methods used by Docker include Docker Image, Container, Client, Host, Engine Rest API, hub, Daemon, and Registry.
What is Docker?
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers…
Docker Tutorial : Pengertian, Fungsi dan Cara Kerjanya
Menjalankan bisnis di dunia teknologi informasi berarti Anda perlu beradaptasi dengan perkembangan yang sangat cepat…
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your…