-
登錄阿里雲控制台,搜索
容器鏡像服務
(界面上沒有可以在搜索框中搜索),進入容器鏡像服務管理控制台,如果需要開通就按照提示開通一下,如下圖所示:
-
在容器鏡像服務控制台最底下有個鏡像加速器,點進去之后有一個加速器地址,使用這個地址作為docker鏡像倉庫,如下圖所示:
-
編輯
/etc/docker/daemon.json
文件(如果沒有則創建),文件中寫入以下內容:{ "registry-mirrors": ["https://tpqjuvmc.mirror.aliyuncs.com"] }
json文件中的地址就是剛才的那個加速器地址
-
重啟docker服務,輸入命令
docker info
,查看是否配置成功,如果鏡像倉庫顯示有如下內容,則配置成功。Registry Mirrors: https://tpqjuvmc.mirror.aliyuncs.com/ Live Restore Enabled: false [root@localhost hk]# docker info Client: Debug Mode: false Server: Containers: 1 Running: 0 Paused: 0 Stopped: 1 Images: 2 Server Version: 19.03.5-rc1 Storage Driver: overlay2 Backing Filesystem: xfs 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: 894b81a4b802e4eb2a91d1ce216b8817763c29fb runc version: 425e105d5a03fabd737a126ad93d62a9eeede87f init version: fec3683 Security Options: seccomp Profile: default Kernel Version: 4.18.0-80.11.2.el8_0.x86_64 Operating System: CentOS Linux 8 (Core) OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 1.764GiB Name: localhost.localdomain ID: NZSO:7CA4:2BJQ:WGVL:C32R:LWOI:B5YF:4LO4:4V6P:FQJJ:Z765:DYSZ 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://tpqjuvmc.mirror.aliyuncs.com/ #如果這里顯示這里剛才的配置的地址,則配置成功 Live Restore Enabled: false