Docker 使用國內(nèi)鏡像倉庫的方法
由于某些原因,導(dǎo)致Docker鏡像在國內(nèi)下載速度特別慢。所以為了沉浸式開發(fā)。最好切換為國內(nèi)源。這里以163 的鏡像倉庫舉例。首先修改/etc/docker/daemon.json配置文件。
sudo vi /etc/docker/daemon.json
將該文件內(nèi)容替換為阿里源。修改后的/etc/docker/daemon.json文件為:
{ 'registry-mirrors': ['http://hub-mirror.c.163.com']}

然后使用systemctl restart docker命令重啟Docker即可。然后使用docker info命令查看鏡像倉庫信息,結(jié)果如下:
root@ubuntu:~# docker infoClient: Debug Mode: falseServer: Containers: 3 Running: 0 Paused: 0 Stopped: 3 Images: 3 Server Version: 19.03.8 Storage Driver: overlay2 Backing Filesystem: <unknown> 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: 4.15.0-97-generic Operating System: Ubuntu 18.04.4 LTS OSType: linux Architecture: x86_64 CPUs: 12 Total Memory: 7.767GiB Name: ubuntu ID: 2XV6:BJ7Q:6BIH:4FIR:HEPL:3GF7:33A2:GGTU:EQMB:EKGX:EO34:5J44 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: http://hub-mirror.c.163.com/ Live Restore Enabled: falseWARNING: No swap limit support

書上的代碼直接運(yùn)行絕大部分是對(duì)的,但是總有一些軟件的更新使得作者無能為力。之前的API是對(duì)的,但是之后就廢棄了或修改了是常有的事。所以我們需要跟蹤源代碼。這只是一個(gè)小小的問題,如果沒有前輩的無私奉獻(xiàn),很難想象我們自己一天能學(xué)到多少內(nèi)容。感謝各位前輩的辛勤付出,讓我們少走了很多的彎路!
到此這篇關(guān)于Docker 使用國內(nèi)鏡像倉庫的方法的文章就介紹到這了,更多相關(guān)Docker 國內(nèi)鏡像倉庫內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. Springboot Druid 自定義加密數(shù)據(jù)庫密碼的幾種方案2. 詳解Android studio 動(dòng)態(tài)fragment的用法3. 解決Android studio xml界面無法預(yù)覽問題4. Spring Boot和Thymeleaf整合結(jié)合JPA實(shí)現(xiàn)分頁效果(實(shí)例代碼)5. 什么是python的自省6. Vuex localStorage的具體使用7. php模擬實(shí)現(xiàn)斗地主發(fā)牌8. Spring MVC+ajax進(jìn)行信息驗(yàn)證的方法9. Vue封裝一個(gè)TodoList的案例與瀏覽器本地緩存的應(yīng)用實(shí)現(xiàn)10. 使用Android studio查看Kotlin的字節(jié)碼教程

網(wǎng)公網(wǎng)安備