Rate This Document
Findability
Accuracy
Completeness
Readability

Installing Docker

  1. Obtain the Docker installation package.
    1. Download the Docker installation package using a local browser.

      Download URL: https://download.docker.com/linux/static/stable/aarch64/docker-18.09.8.tgz

    2. Upload the downloaded installation package 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.

      1
      cd /home
      
      1
      wget https://download.docker.com/linux/static/stable/aarch64/docker-18.09.8.tgz --no-check-certificate
      
  2. Decompress the package and install Docker.
    1
    tar xvpf docker-18.09.8.tgz
    
    1
    cp -p -f docker/* /usr/bin
    
  3. Prepare the environment.
    1. Disable the firewall.
      1
      setenforce 0
      
      1
      systemctl stop firewalld
      
      1
      systemctl disable firewalld
      
    2. Restart the server for the modification of the configuration file to take effect.
  4. Configure the docker.service.
    1. Open the docker.service file.
      1
      vim /usr/lib/systemd/system/docker.service
      
    2. Edit the file as follows. Save the file and exit.
      [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
  5. Start the related services.
    1
    systemctl daemon-reload
    
    1
    systemctl status docker
    
    1
    systemctl restart docker
    
    1
    systemctl status docker
    
    1
    systemctl enable docker
    
    1. 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.
    2. If Docker fails to be restarted, check whether the preceding installation operations and related configurations are correct. In addition, you can restart the server to prevent the configuration file from being occupied due to incorrect configuration operations. You can perform subsequent operations only after Docker is started properly.
  6. Configure the image source.
    1. Open the daemon.json file.
      1
      vim /etc/docker/daemon.json
      
    2. Edit the file as follows. Save the file and exit.
      {
          "registry-mirrors":["https://docker.huaweicloud.com"]
      }
    3. Restart the related services for the settings to take effect.
      1
      systemctl daemon-reload
      
      1
      systemctl restart docker
      
  7. Verify the Docker information.
    1
    docker version
    
    Docker is successfully installed if the following information is displayed:
    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