Docker
Docker technology is currently being loved by application developers. Many large companies and start-ups implement Docker as a support for their business. Various kinds of service applications have now been ported to docker virtualization, such as MySQL, PHP, apache, docker, MongoDB, and so on. They are now implementing docker as a supporter of their performance. This article will review Docker technology.
What is Docker?
Docker is a set of platform as a service (PaaS) products that use OS-level virtualization to deliver software in packages called containers. Containers are isolated from one another and bundle their own software, libraries, and configuration files. Therefore, they can communicate with each other through well-defined channels. All containers are run by a single operating system kernel and therefore use fewer resources than virtual machines.
It is a virtualization technology used to simplify application development. In fact, Docker is a fairly new technology. It was first introduced by Solomon Hykes at the PyCon US event in 2013. It has the ability to run applications with different system configurations, even though it is still on one computer or server device. Thus, it develops very quickly because it is very liked by developers.
What are the features of Docker?
Docker features include:
- Docker Engine
Build Docker images and create Docker containers.
- Docker Hub
The registry for various Docker images
- Docker Compose
Define applications using multiple Docker containers.
How is Docker Architecture?
The docker component consists of 3 parts: client, host, and registry
Client
The docker client application is just a terminal application that is used to execute commands to the docker server/host. The host will execute the command and the client will receive the result.
An example of a Docker client application is:
- Docker build: to create a new container.
- Docker pull: to download Docker images or local repositories on hosts in the public or private registry.
- Docker run: to run processes in containers.
Host
The Docker Host is responsible for receiving commands from the Docker Client and providing an environment to run the complete software. It runs on the server-side, so it can also be called a docker server. Inside this docker, there is a docker daemon. It is responsible for managing Docker Images & Containers and receiving requests from the Docker API that the system will then process.
Registry
The Docker Registry is a container for storing a Docker image. Later on, it will give the output according to the given command.
Here’s an overview of the components in docker involved:
What is the difference between Docker vs VM (Virtual Machine)
In some cases, docker has a lot in common with virtual machine (VM) technology. However, docker technology is completely different from virtual machines. The following picture is a comparison of Docker’s visualization with a virtual machine.
The difference between Docker and Virtual Machine (VM) is summarized in the following table.
Docker | Virtual Machine (VM) |
Represents operation system virtualization | Represents hardware-level virtualization |
Lightweight | Heavyweight |
Real-time provisioning & scalability | Slow provisioning |
Native performance | Limited performance |
Process-level isolation & hence less secure | Fully isolated & hance more secure |
Slower in packing and installing apps | Faster in packing and installing apps |
How to Install Docker?
In this article, we will demonstrate the installation of docker for the Windows environment. The steps to install Docker on Windows 10 are as follows:
- Download the Docker installer.
- Choose the windows version
- Prior to the installation, you must enable the Hyper-V Backend and Windows Container features first. To enable it can be read in the official documentation from Windows here.
- Run the installation file by right-clicking and selecting run as administrator on the file and wait for the process to complete.
- To check whether the installation was successful or not, use the following command:
Docker Version
The result shows the data about the docker system installed on our device.
The following will explain the implementation of the Postgre SQL installation using the docker-compose file:
- Create a folder/directory first, for example, “postgre”.
- Create a docker-compose.yml file and then type this code into the file:
# Use postgres/example user/password credentials version: '3.1' services: db: image: postgres restart: always environment: POSTGRES_PASSWORD: example ports: - 5432:5432 adminer: image: adminer restart: always ports: - 8080:8080
- Save the docker-compose.yml file to the “postgre” folder we created earlier
- Open the command line then cd to the “postgre” directory
- Type the command :
CODE
docker-compose up
The following log will appear and indicate the installation is being carried out. If you do this command for the first time, Docker will download the required files.
- To check whether the installation was successful or not, it can be seen via the Docker dashboard.
- The “postgre” container is already running. Try to open it via browser with management database at URL: localhost:8080
Troubleshoots
- If docker container can’t be killed or stopped run : aa-remove-unknown
Conclusion
Docker is a virtualization technology used to simplify application development. It works as a container or open-source container to accommodate various types of applications in one place. With a container system, all application creation, module, monitoring, and infrastructure management work can be faster, more efficient, and more secure. Docker features include Docker Engine, Docker Hub, Docker Compose.