directory

• Write it first

• Install and use on Linux

Ubuntu installation

CentOS7 installation

Mirror to accelerate

Windows installation and use

Mirror to accelerate


• Write it first

Recently, I came into contact with Docker in my development project, and then I started to study Docker. I didn’t expect it to be so useful. I didn’t know it, so let’s talk about it now. So what’s so special about Docker? Docker adds an application deployment engine to the virtualized container execution environment. The goal of the engine is to provide a lightweight, fast environment that can run developers’ programs and deploy them easily and efficiently from the developer’s laptop to a test environment and then to production. Docker is extremely compact, and all it requires is a host with only a compatible version of the Linux kernel installed and minimal binaries.

Its core components are as follows

  • Docker client and server: The Docker client simply issues a request to the Docker server or daemon, which does all the work and returns the result. Docker provides a command line tool Docker and a set of RESTful apis ®. You can run the Docker daemon daemon client on the same host, or connect from a local Docker client to a remote Docker guard process running on another host.
  • Docker images: Docker images are static, you can’t manipulate them, you can only pull someone else’s image or push your own image.
  • Registry: Subclass like GitHub
  • Docker containers: Docker helps you build and deploy containers by packaging your own applications or services into them. As we mentioned earlier, the container is launched based on an image, and one or more processes can run in the container. We can think of images as the build or package phase of the Docker life cycle, and containers as the start or execution phase.

• Install and use on Linux

Ubuntu installation

First, log in to Ubuntu as a user with sudo permission. Once logged in, check to see if you have wget installed, using the following commands (for the record, you can also download and install it using yum).

$ which wget
Copy the code

If wget is not installed, upgrade package manager first and then install it with the following upgrade instructions

$ sudo apt-get update 
$ sudo apt-get install wget
Copy the code

Then use the following command to obtain the latest version of the Docker installation package

Step 1: Install the necessary system tools
sudo apt-get update
sudo apt-get -y install apt-transport-https ca-certificates curl software-properties-common

# Step 2: Install the GPG certificate
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/ubuntu/gpg | sudo apt-key add -

# step 3: Write software source information
sudo add-apt-repository "deb [arch=amd64] https://mirrors.aliyun.com/docker-ce/linux/ubuntu $(lsb_release -cs) stable"

Step 4: Update and install docker-CE
sudo apt-get -y update
sudo apt-get -y install docker-ce
Copy the code

The system will prompt you to input the sudo password. After input, the script will be downloaded and Docker and dependency packages will be installed. After installation, you can use the following commands to verify whether Docker is correctly installed

$ docker version
Copy the code

CentOS7 installation

Here we use CentOS7.6 for example installation, above we demonstration is wget to install, here we use yum to install, note that when using yum to install, we need to first replace the yum source into the domestic mirror site oh, I replace here is ali cloud mirror site, If you do not know how to replace the yum source, please refer to my other article (replace the yum source). The steps are as follows:

Step 1: Install the necessary system tools
sudo yum install -y yum-utils device-mapper-persistent-data lvm2

# Step 2: Add software source information
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

Step 3: Update and install docker-CE
sudo yum makecache fast
sudo yum -y install docker-ce

# Step 4: Start Docker service
sudo service docker start
Copy the code

Mirror to accelerate

Json file. If there is no daemon. Json file, we need to create one by ourselves.

touch damon.json
Copy the code

After creating the file, type the following into the file:

Then restart the service as follows:

Added: Ali Cloud mirror

Modify mirror acceleration in another way. Use systemctl enable docker enable service, edit the/etc/systemd/system/multi – user. Target. Wants/docker. Service files, find ExecStart = this line, At the end of this line, add the accelerator address — registry-mirror=< accelerator address >, such as: change the XXXX to your password in Aliyun Docker image.

ExecStart=/usr/bin/dockerd --registry-mirror=https://xxxxx.mirror.aliyuncs.com
Copy the code

 

Windows installation and use

Windows10 is used here. Now Docker has a special installation package of Win10 Professional version system, which requires the activation of Hyper-V (it is complicated to install with other Windows versions, and requires the use of Toolbox for installation).

We use the Docker client of Windows to control the construction, running and management of the Docker virtualization engine. Although you are using a Windows Docker client, the Docker engine container still runs on a Linux host (now through a Virtual box). But to run on Windows, we just need to start a Linux container on your Windows host.

Before you can go to GitHub download, but GitHub can not be used, now need to download from dockerHub above, before downloading need to register a Docker Hub account oh (of course, external software generally can not avoid the domestic Ali image, Ali image address), after downloading, Run the installation file, which will install VirtualBox, the msys-git Boot2Docker Linux image, and the boot2Docker administration tools. Here I show you how to download and install dockerHub (official installation is always up to date, hahaha).

When the installation is complete, Docker will start automatically. A small whale icon appears on the notification barThis indicates that the Docker is running. We can run docker version from the command line to check the version number, docker run hello-world to load the test image test. If it doesn’t start, you can start it by searching for Docker in Windows.

Mirror to accelerate

For Windows 10, right-click the Docker icon in the lower right corner of the system and choose Settings. Open the configuration window and choose Daemon from the navigation menu on the left. Enter the accelerator address registry.docker-cn.com in the Registrymirrors column, and click Apply to save. Docker will restart and Apply the configured image address.