ubuntu20.04下默認(rèn)是snap安裝的docker。安裝位置和apt安裝的不一樣。所以daemon.json的位置也不一樣。國(guó)內(nèi)網(wǎng)上說(shuō)的都是往/ect/docker/daemon.json里添加
"registry-mirrors": [
? ? ? ? "http://hub-mirror.c.163.com",
? ? ? ? "https://docker.mirrors.ustc.edu.cn",
? ? ? ? "https://registry.docker-cn.com"
? ? ]
統(tǒng)統(tǒng)都不對(duì)。
google一下。原來(lái)在這里。/var/snap/docker/current/config/daemon.json
本來(lái)就有這個(gè)文件,不用新建。
往里加了"registry-mirrors"這一段。然后呢重啟docker。
怎么重啟呢?
國(guó)內(nèi)網(wǎng)上告訴你systemctl restart docker。你會(huì)發(fā)現(xiàn)
Failed to restart docker.service: Unit docker.service not found.
網(wǎng)上一大堆人告訴你重裝docker。其實(shí)snap安裝的docker。用snap命令就行了。
snap restart docker
搞定!文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-500571.html
xxx@ubuntu:/tmp# docker info文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-500571.html
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 1
Server Version: 20.10.17
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
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: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc version:
init version: de40ad0
Security Options:
apparmor
seccomp
Profile: default
Kernel Version: 5.4.0-132-generic
Operating System: Ubuntu Core 18
OSType: linux
Architecture: x86_64
CPUs: 6
Total Memory: 7.607GiB
Name: ubuntu2004s
ID: I3F2:HD62:YSLM:GIGZ:JAB2:RBEI:MHNF:PDXT:Z3JQ:MY6R:SS72:S252
Docker Root Dir: /var/snap/docker/common/var-lib-docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
http://hub-mirror.c.163.com/
https://docker.mirrors.ustc.edu.cn/
https://registry.docker-cn.com/
Live Restore Enabled: false
到了這里,關(guān)于ubuntu20.04以及更高版本下docker添加國(guó)內(nèi)鏡像的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!