“This is the 9th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021.”

Docker lets you package all your apps and their history into standardized units of software development.

The Docker container packages the software and all the files it needs to run the installation (code, runtime, system tools, system libraries) together, which ensures that it will always run the same way, regardless of the runtime environment.

Docker version introduction

Docker is available in docker-CE and Docker-EE.

Docker-ce refers to the Docker Community Edition, maintained by the community and provided technical support, for free version, suitable for individual developers and small teams.

Docker-ee refers to Docker Enterprise Edition, a paid version, which is provided with technical support by after-sales team and technical team and designed for enterprise development and IT team. Compared with Docker-EE, it adds some additional functions and, more importantly, provides more security.

In addition, Docker releases are divided into Stable releases and Edge releases, the difference being that the former is Stable releases quarterly (slow releases) and the latter is Edge releases monthly (fast releases).

In general, Docker-CE is sufficient for our needs.

The installation of a Docker

Docker is installed on Windows/MacOS and Centos/Ubuntu

How to install Docker on centos/ Ubuntu

Docker installation is recommended to use ali cloud source, fast speed.

The installation of the official tutorial: https://docs.docker.com/install/linux/docker-ce/centos/#install-using-the-repository

Ali source installation tutorial: https://help.aliyun.com/document_detail/60742.html

Ubuntu:

# 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 http://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] http://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

Centos:

# 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 http://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
Docker installation on Windows/MacOS

Take a look at the official requirements for the installation environment:

Docker for Windows, Windows10 X64 support Hyper-V

Docker Toolbox is required for Windows10 and below. Docker Toolbox is available for Windows7/8.1.

Here is the official download address:

http://get.daocloud.io/#install-docker-for-mac-windows
Copy the code

Once downloaded, install foolproof.

How do I verify the installation?

Enter docker version in the command line and output a bunch of version information to indicate that the installation is successful.

As follows:

Docker accelerator configuration

Docker accelerator can improve the speed of obtaining Docker official image in China, otherwise the process of downloading the image will be slow, or even can not download the image.

Configure Ali Cloud accelerator

Log in to your Aliyun console and go to the container Image Service -> Image Accelerator -> Replication Accelerator address.

Can’t find this point:

https://cr.console.aliyun.com/cn-hangzhou/mirrors
Copy the code
  • Centos/Ubuntu

Use the accelerator by modifying the daemon configuration file /etc/docker-daemon. json.

sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://thd78540.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
Copy the code
  • Windows/MacOS with Docker Toolbox installed

Create a Linux VM with the Docker environment installed, specify the machine name as default, and configure the Docker accelerator address.

docker-machine create --engine-registry-mirror=https://thd78540.mirror.aliyuncs.com -d virtualbox default
Copy the code

View the environment configuration of the machine, and configure to the local, and access Docker service through the Docker client.

docker-machine env default
eval "$(docker-machine env default)"
docker info
Copy the code
  • Docker for Windows

Right-click in the tray icon at the lower right corner of the system and choose Settings. Open the configuration window and choose Docker Daemon from the navigation menu on the left. Edit the JSON string in the window and fill in the accelerator address below:

{
  "registry-mirrors": ["https://thd78540.mirror.aliyuncs.com"]}Copy the code

After editing, click Apply to save and wait for Docker to restart and Apply the configured image accelerator.