Rate This Document
Findability
Accuracy
Completeness
Readability

Migrating from Docker to Docker

  1. Obtain the Docker collection package, including the system-level dependency package and Docker installation package.
  2. Decompress the Docker collection package and go to the decompressed directory.
    1
    2
    tar -xzf docker.tar.gz
    cd docker
    
  3. Install system-level dependencies for your OS.
    • Kylin OS
      1
      tar -xzf Kylin-Server-V10-SP3-2403-Release-20240426-arm64.tar.gz;rpm -ivh ./Kylin-Server-V10-SP3-2403-Release-20240426-arm64/container-selinux-2.138.0-1.p01.ky10.noarch.rpm;rpm -ivh ./Kylin-Server-V10-SP3-2403-Release-20240426-arm64/libcgroup-0.42.2-4.ky10.aarch64.rpm
      
    • UOS V20 1060e
      1
      tar -xzf uos-server-20-1060e-20240820-arm64.tar.gz;rpm -ivh ./uos-server-20-1060e-20240820-arm64/container-selinux-2.138.0-1.uel20.noarch.rpm;rpm -ivh ./uos-server-20-1060e-20240820-arm64/libcgroup-0.42.2-3.uel20.aarch64.rpm
      
  4. Install Docker.
    1
    2
    tar -xzf Docker-26.1.3-rpm.tar.gz;
    rpm -ivh ./Docker-26.1.3-rpm/*.rpm
    
  5. Verify that Docker is installed.
    1
    docker --version
    

    If the following information is displayed, the installation is successful:

  6. Migration the Docker configuration files.
    1. Check whether the configuration files exist on the source server.
      1
      2
      3
      find "${HOME}"/.docker/ -name "config.json";
      find /etc/docker/ -name "daemon.json";
      find /etc/systemd/system/docker.service.d/ -name "http-proxy.conf"
      
    2. Collect the configuration files based on the command output in the previous step.
      1. Create a temporary directory for storing the configuration files.
        1
        mkdir -p "${HOME}"/DockerConf
        
      2. If the configuration files exist, run the following commands:
        1
        2
        3
        tar -Pczvf "${HOME}"/DockerConf/config.json.tar.gz "${HOME}"/.docker/config.json;
        tar -Pczvf "${HOME}"/DockerConf/daemon.json.tar.gz /etc/docker/daemon.json;
        tar -Pczvf "${HOME}"/DockerConf/http-proxy.conf.tar.gz /etc/systemd/system/docker.service.d/http-proxy.conf
        
      3. Compress the Docker configuration files.
        1
        cd "${HOME}" && tar -czvf DockerConf.tar.gz DockerConf && rm -rf ./DockerConf
        
    3. On the target server, create a directory for storing the configuration files.
      1
      mkdir -p "${HOME}"/.docker/ /etc/docker/
      
    4. Decompress the configuration files.
      1
      2
      3
      tar -tzf "${HOME}"/DockerConf.tar.gz | grep -q 'config.json.tar.gz' && tar -xzf "${HOME}"/DockerConf.tar.gz DockerConf/config.json.tar.gz --to-command='tar -Pxzvf - --no-same-owner';
      tar -tzf "${HOME}"/DockerConf.tar.gz | grep -q 'daemon.json.tar.gz' && tar -xzf "${HOME}"/DockerConf.tar.gz DockerConf/daemon.json.tar.gz --to-command='tar -Pxzvf - --no-same-owner';
      tar -tzf "${HOME}"/DockerConf.tar.gz | grep -q 'http-proxy.conf.tar.gz' && tar -xzf "${HOME}"/DockerConf.tar.gz DockerConf/http-proxy.conf.tar.gz --to-command='tar -Pxzvf - --no-same-owner'
      
    5. Reclaim resources.
      1
      rm -rf "${HOME}"/DockerConf.tar.gz
      
  7. Restart the Docker service.
    1
    sudo systemctl restart docker.service