Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure Docker-CE Image acceleration in Ubuntu

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

How to configure Docker-CE image acceleration in Ubuntu? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Experimental environment

Operating system: Ubuntu 18.04.4 LTS

LAN IP: 192.168.3.22

Docker is an integral part of modern software development and DevOps continuous integration and deployment pipeline, and most companies use containerization technology to reduce server costs.

Install the necessary system resource library

Root@linuxcool:~$ sudo apt-get updateroot@linuxcool:~$ sudo apt-get-y install apt-transport-https ca-certificates curl software-properties-common

Install GPG certificate

Root@linuxcool:~$ curl-fsSL https://mirrors.nwafu.edu.cn/docker-ce/linux/ubuntu/gpg | sudo apt-key add-

The Docker server is abroad, so it will be very slow to install docker using docker.io, and sometimes it will not be installed successfully due to the timeout. Therefore, I am using the domestic image acceleration of the Network and Educational Technology Center of Northwest University of Agriculture and Forestry Science and Technology, and there are many image acceleration sites in China, such as Aliyun, Tencent Cloud, NetEase, Tsinghua University and so on.

Update the system and install Docker-CE

Root@linuxcool:~$ sudo apt-get-y updateroot@linuxcool:~$ sudo apt-get-y install docker-ce

The latest version of docker is installed through the above command. If you want to install docker, please continue to read the following

Find the version of Docker-CE

Apt-cache madison docker-ce docker-ce | 5https://mirrors.aliyun.com/docker-ce/linux/ubuntu 19.03.8room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5https://mirrors.aliyun.com/docker-ce/linux/ubuntu 19.03.7room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5https://mirrors.aliyun.com/docker-ce/linux/ubuntu 19.03.6room3-0~ubuntu-bionic | Packages docker-ce | 5https://mirrors.aliyun.com/docker-ce/linux/ubuntu 19.03.5room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5https://mirrors.aliyun.com/docker-ce/linux/ubuntu 19.03.4room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5https://mirrors.aliyun.com/docker-ce/linux/ubuntu 19.03.3room3-0~ubuntu-bionic | 5 : 19.03.2room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5vig 19.03.1room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5purl 19.03.0room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5purl 18.09.9room3 -0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5https://mirrors.aliyun.com/docker-ce/linux/ubuntu 18.09.8room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5VOR 18.09.7room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5Vera 18.09.6room3-0~ubuntu-bionic | https : / / mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5https://mirrors.aliyun 18.09.5room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5Vera 18.09.4room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5Vera 18.09.3room3-0~ubuntu-bionic | https://mirrors.aliyun .com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5https://mirrors.aliyun.com/docker-ce 18.09.2room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5vig 18.09.1room3-0~ubuntu-bionic | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 5https://mirrors.aliyun.com/docker-ce 18.09.0room3-0~ubuntu-bionic | / linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.3~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.2~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.1~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.06.0~ce~3 -0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages docker-ce | 18.03.1~ce~3-0~ubuntu | https://mirrors.aliyun.com/docker-ce/linux/ubuntu bionic/stable amd64 Packages

Install a specified version of Docker-CE, such as 19.03.8room3-0~ubuntu-bionic

Root@linuxcool:~$ sudo apt-get-y install docker-ce=19.03.8~3-0~ubuntu-bionic

Installation check

Root@linuxcool:~$ sudo docker versionClient: Docker Engine-Community Version: 19.03.8 API version: 1.40 Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:25:46 2020 OS/Arch: linux/amd64 Experimental: falseServer: Docker Engine-Community Engine: Version: 19.03.8 API version: 1.40 (minimum Version 1.12) Go version: go1.12.17 Git commit: afacb8b7f0 Built: Wed Mar 11 01:24:19 2020 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.2.13 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc: Version: 1.0.0-rc10 GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd docker-init: Version: 0.18.0 GitCommit: fec3683

Configure Mirror acceleration

# create daemon.json configuration file root@linuxcool:~$ sudo vim / etc/docker/daemon.json {"registry-mirrors": ["https://dockerhub.mirrors.nwafu.edu.cn/"]}# default daemon.json file does not exist. If the daemon.json file does not exist, create it yourself.

Load configuration and restart docker service

Root@linuxcool:~$ sudo systemctl daemon-reloadroot@linuxcool:~$ sudo systemctl restart docker

Verify that the configuration of image acceleration is effective

Root@linuxcool:~$ sudo docker info Client: Debug Mode: falseServer: Containers: 0 Running: 0 Paused: 0 Stopped: 0 Images: 0 Server Version: 19.03.8 Storage Driver: overlay2 Backing Filesystem:Supports d_type: true Native Overlay Diff: true Logging Driver: json-file Cgroup Driver: cgroupfs Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: runc Default Runtime: runc Init Binary: docker-init containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd init version : fec3683 Security Options: apparmor seccomp Profile: default Kernel Version: 5.3.0-51-generic Operating System: Ubuntu 18.04.4 LTS OSType: linux Architecture: x86: 64 CPUs: 8 Total Memory: 15.64GiB Name: linuxcool ID: K252:G32L:GWWN:J5FE:3MFZ:2ITG:UE7Y:Y26F:QT3Q:2PLS:HCUX:PJYZ Docker Root Dir: / var/lib/docker Debug Mode: false Registry: https://index.docker.io/v1/ Labels: Experimental: false Insecure Registries: 127.0 . 0.0/8 Registry Mirrors: https://dockerhub.mirrors.nwafu.edu.cn/ Live Restore Enabled: falseWARNING: No swap limit support

Registry Mirrors defaults to docker.io. If you see that Registry Mirrors changes to https://dockerhub.mirrors.nwafu.edu.cn, the configuration is already in effect.

Docker service management

# self-starting service root@linuxcool:~$ sudo systemctl enable docker.service# service status root@linuxcool:~$ sudo systemctl status docker.service# starting service root@linuxcool:~$ sudo systemctl start docker.service# restarting service root@linuxcool:~$ sudo systemctl restart docker.service# stopping service root@linuxcool:~$ sudo systemctl stop docker.service

Pull the image

Root@linuxcool:~$ sudo docker pull centos:8.1.19118.1.1911: Pulling from library/centos8a29a15cefae: Pull complete Digest: sha256:fe8d824220415eed5477b63addf40fb06c3b049404242b31982106ac204f6700Status: Downloaded newer image for centos:8.1.1911docker.io/library/centos:8.1.1911 's answer to the question on how to configure Docker-CE image acceleration in Ubuntu is shared here. I hope the above content can be of some help to you, if you still have a lot of questions to solve. You can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report