Rate This Document
Findability
Accuracy
Completeness
Readability

Installing Docker

  1. 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.

    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. 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
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  5. 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
  6. Configure the image source.
    1. Open the daemon.json file.
      1
      vim /etc/docker/daemon.json
      
    2. Press i to enter the insert mode and edit the following content:
      1
      2
      3
      {
          "registry-mirrors":["https://docker.huaweicloud.com"]
      }
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
    4. Restart the related services for the settings to take effect.
      1
      2
      systemctl daemon-reload
      systemctl restart docker
      
  7. Verify the Docker information.
    1
    docker version
    
    Docker 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