Installing Docker
- Obtain the Docker installation package and upload it to the server using a tool such as FTP.
If the server is connected to the Internet, you can run the wget command on the server to download the binary package.
1cd /home
1wget https://download.docker.com/linux/static/stable/aarch64/docker-18.09.8.tgz --no-check-certificate
- Decompress the package and install Docker.
1tar xvpf docker-18.09.8.tgz
1cp -p -f docker/* /usr/bin
- Prepare the environment.
- Disable the firewall.
1setenforce 0
1systemctl stop firewalld
1systemctl disable firewalld
- Restart the server for the modification of the configuration file to take effect.
- Disable the firewall.
- Configure the docker.service.
- Open the docker.service file.
1vim /usr/lib/systemd/system/docker.service - Press i to enter the insert mode and edit the file as follows:
[Unit] Description=Docker Application Container Engine Documentation=http://docs.docker.com After=network.target docker.socket [Service] Type=notify EnvironmentFile=-/run/flannel/docker WorkingDirectory=/usr/local/bin ExecStart=/usr/bin/dockerd -H tcp://0.0.0.0:4243 -H unix:///var/run/docker.sock --selinux-enabled=false --log-opt max-size=1g ExecReload=/bin/kill -s HUP # Having non-zero Limit*s causes performance problems due to accounting overhead # in the kernel. We recommend using cgroups to do container-local accounting. LimitNOFILE=infinity LimitNPROC=infinity LimitCORE=infinity # Uncomment TasksMax if your systemd version supports it. # Only systemd 226 and above support this version. #TasksMax=infinity TimeoutStartSec=0 # set delegate yes so that systemd does not reset the cgroups of docker containers Delegate=yes # kill only the docker process, not all processes in the cgroup KillMode=process Restart=on-failure [Install] WantedBy=multi-user.target
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the docker.service file.
- Start the related services.
1 2 3 4 5
systemctl daemon-reload systemctl status docker systemctl restart docker systemctl status docker systemctl enable docker
- When the systemctl status docker command is executed for the first time, the Docker loading status is error because the configured docker.service has not been started.
- If Docker restart fails, check the preceding installation operations and related configurations. In addition, you can restart the server to clear process conflicts or configuration file lock issues caused by incorrect configurations. Proceed to the next step only after Docker has started successfully
- Configure the image source.
- Open the daemon.json file.
1vim /etc/docker/daemon.json - Press i to enter the insert mode and edit the following content:
1 2 3
{ "registry-mirrors":["https://docker.huaweicloud.com"] }
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Restart the related services for the settings to take effect.
1 2
systemctl daemon-reload systemctl restart docker
- Open the daemon.json file.
- Verify the Docker information.
1docker versionDocker is successfully installed if the following information is displayed:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Client: Docker Engine - Community Version: 18.09.8 API version: 1.39 Go version: go1.10.8 Git commit: 0dd43dd Built: Wed Jul 17 17:39:22 2019 OS/Arch: linux/arm64 Experimental: false Server: Docker Engine - Community Engine: Version: 18.09.8 API version: 1.39 (minimum version 1.12) Go version: go1.10.8 Git commit: 0dd43dd Built: Wed Jul 17 17:53:39 2019 OS/Arch: linux/arm64 Experimental: false
Parent topic: Docker