CentOS7.9. Install Docker offline

Install Docker offline on CentOS 7

  1. Download the Docker installation package for CentOS 7:

     https://download.docker.com/linux/static/stable/x86_64/
    
  2. Upload the downloaded docker-24.0.4.tgzfile to the CentOS 7 system. For example, it can be uploaded to /rootthe directory.

  3. Unzip docker-24.0.4.tgzthe file:

    tar -xf docker-24.0.4.tgz
    
  4. Copy all the extracted Docker files to /usr/bin/the directory:

    cp docker/* /usr/bin/
    
  5. Register Docker as a service, enter /etc/systemd/system/the directory, and create docker.servicea file:

    vi /etc/systemd/system/docker.service
    
  6. Copy the following content into docker.servicethe file. Replace 192.168.3.10with the IP address of your own server:

    [Unit]
    Description=Docker Application Container Engine
    Documentation=https://docs.docker.com
    After=network-online.target firewalld.service
    Wants=network-online.target
    
    [Service]
    Type=notify
    ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=192.168.3.10
    ExecReload=/bin/kill -s HUP $MAINPID
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitCORE=infinity
    Delegate=yes
    KillMode=process
    Restart=on-failure
    StartLimitBurst=3
    StartLimitInterval=60s
    
    [Install]
    WantedBy=multi-user.target
    
  7. Give docker.servicethe file execution permission:

    chmod 644 /etc/systemd/system/docker.service
    
  8. Reload the systemd daemon to apply the changes:

    systemctl daemon-reload
    
  9. Start Docker and set it to start automatically at boot:

    systemctl start docker
    systemctl enable docker
    
  10. Test Docker to make sure it's working.

Uninstall Docker on CentOS 7

  1. Cancel Docker's boot self-start:

    systemctl disable docker
    
  2. Delete the Docker service file:

    rm -rf /etc/systemd/system/docker.service
    
  3. Remove Docker related binaries:

    rm -rf /usr/bin/containerd
    rm -rf /usr/bin/containerd-shim
    rm -rf /usr/bin/ctr
    rm -rf /usr/bin/runc
    rm -rf /usr/bin/docker*
    
  4. Delete the Docker configuration file:

    rm -rf /etc/docker/
    
  5. If images or containers exist, delete them:

    rm -rf /var/lib/docker
    

Extension: import image and run

If you want to run the image on a machine without an external network connection, take PaddleOCR as an example:

  1. On a machine connected to the Internet, download the PaddleOCR Docker image and its dependencies (version 1.6.server):
docker pull registry.cn-hongkong.aliyuncs.com/llapi/ppocr:1.6.server
  1. Save the Docker image and its dependencies as a tar file:
docker save -o ppocr_1.6.server.tar registry.cn-hongkong.aliyuncs.com/llapi/ppocr:1.6.server
  1. Copy the Docker image file "ppocr_1.6.server.tar" to the target machine without external network connection.

  2. Install Docker on the target machine.

  3. Load the Docker image with the following command:

docker load -i ppocr_1.6.server.tar
  1. Run the PaddleOCR container:
docker run -itd --name ppocr -p 9000:9000 registry.cn-hongkong.aliyuncs.com/llapi/ppocr:1.6.server /bin/bash -c "sh /PaddleOCR/start.sh"

The PaddleOCR container version 1.6.server should now be running on the target machine with no external internet connection, and you can access it on port 9000. This concludes the tutorial

Guess you like

Origin blog.csdn.net/qq_39997939/article/details/131883393