Introduction to docker and docker-compose installation

In the past, when we configured an application's operating environment on the server, we had to install various components. For example, in the JavaWeb environment, we had to install Tomcat, MySQL, etc. Not to mention how troublesome it was to install and configure these things, it was not cross-platform.

What is Docker?

It is an open source application container engine that automates the deployment of applications in software containers.On the operating system, it provides an additional software abstraction layer and an automatic management mechanism for virtualization at the operating system level. Docker uses the resource separation mechanism in the Linux kernel, such as cgroups, and the Linux kernel namespace to create independent containers. Developers can package their applications and dependent packages into a portable container and then publish them to any popular Linux machine or Windows machine. Virtualization can also be achieved. The container is completely sandboxed and there is no interface between them.
A complete Docker consists of the following parts:
1.DockerClient
2.Docker Daemon
3.Docker Image
4.DockerContainer container

Install Docker

Run the command to install docker

curl -sSL https://get.docker.com/ | sh

Verify that the installation was successful

docker -v

Add the current user to the docker group. Otherwise, you must use sudo to execute docker commands. If you use the www user, please change the username below.

sudo usermod -aG docker root sudo service docker restart

For example, if you often use two users, one root and one www, you can also add both users to the docker group.

What is Docker Compose?

It is the last piece of Docker orchestration service. The aforementioned Machine allows users to quickly install Docker on other platforms, Swarm allows Docker containers to run efficiently in a cluster, and Compose allows users to deploy distributed applications in a cluster. Simply put, Docker Compose is an "application layer" service. Users can define which container group runs which application. It supports dynamic changes to applications and expansion when needed.

Install docker-compose

curl -L https://github.com/docker/compose/releases/download/1.10.0/docker-compose-uname -s-uname -m > docker-compose sudo cp docker-compose /usr/local/bin/ sudo chmod +x /usr/local/bin/docker-compose

Configure domestic mirror sources
The default docker image source is outside the Great Firewall, and the download speed is slow. You can configure a domestic image source to increase the download speed. Edit the file and add the following options to /etc/docker/daemon.json (if there is no such file, please create one first):

{ "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn"] }

score

Leave a Reply

Your email address will not be published. Required fields are marked *