[root@vwlin docker]# docker-compose up
Creating network "docker_default" with the default driver
Building mysql
Step 1/2 : FROM mysql:5.7
Trying to pull repository docker.io/library/mysql ...
ERROR: Service 'mysql' failed to build: Get https://registry-1.docker.io/v2/library/mysql/manifests/5.7: net/http: TLS handshake timeout

[root@vwlin docker]# dig @114.114.114.114 registry-1.docker.io

-bash: dig: command not found

[root@vwlin docker]# yum whatprovides dig

Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • centos-sclo-rh: mirrors.163.com
  • centos-sclo-sclo: mirrors.163.com
  • epel: mirror.lzu.edu.cn
  • extras: mirrors.163.com
  • updates: mirrors.163.com
    base/7/x86_64/filelists_db | 7.2 MB 00:00:05

centos-sclo-rh/x86_64/filelists_db | 10 MB 00:00:09
centos-sclo-sclo/x86_64/filelists_db | 935 kB 00:00:00
epel/x86_64/filelists_db | 12 MB 00:00:10
extras/7/x86_64/filelists_db | 225 kB 00:00:00
updates/7/x86_64/filelists_db | 3.4 MB 00:00:02
zabbix/x86_64/filelists_db | 22 kB 00:00:00
zabbix-non-supported/x86_64/filelists | 660 B 00:00:00
32:bind-utils-9.11.4-26.P2.el7.x86_64 : Utilities for querying DNS name servers
Repo : base
Matched from:
Filename : /usr/bin/dig

32:bind-utils-9.11.4-26.P2.el7_9.2.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/dig

32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64 : Utilities for querying DNS name servers
Repo : updates
Matched from:
Filename : /usr/bin/dig

[root@vwlin docker]# yum install bind-utils -y

Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile

  • base: mirrors.aliyun.com
  • centos-sclo-rh: mirrors.163.com
  • centos-sclo-sclo: mirrors.163.com
  • epel: mirror.lzu.edu.cn
  • extras: mirrors.163.com
  • updates: mirrors.163.com
    Resolving Dependencies

--> Running transaction check
---> Package bind-utils.x86_64 32:9.11.4-26.P2.el7_9.3 will be installed
--> Processing Dependency: bind-libs-lite(x86-64) = 32:9.11.4-26.P2.el7_9.3 for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Processing Dependency: bind-libs(x86-64) = 32:9.11.4-26.P2.el7_9.3 for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Processing Dependency: liblwres.so.160()(64bit) for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Processing Dependency: libisccfg.so.160()(64bit) for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Processing Dependency: libisc.so.169()(64bit) for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Processing Dependency: libirs.so.160()(64bit) for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Processing Dependency: libdns.so.1102()(64bit) for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Processing Dependency: libbind9.so.160()(64bit) for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Processing Dependency: libGeoIP.so.1()(64bit) for package: 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64
--> Running transaction check
---> Package GeoIP.x86_64 0:1.5.0-14.el7 will be installed
--> Processing Dependency: geoipupdate for package: GeoIP-1.5.0-14.el7.x86_64
---> Package bind-libs.x86_64 32:9.11.4-26.P2.el7_9.3 will be installed
--> Processing Dependency: bind-license = 32:9.11.4-26.P2.el7_9.3 for package: 32:bind-libs-9.11.4-26.P2.el7_9.3.x86_64
---> Package bind-libs-lite.x86_64 32:9.11.4-26.P2.el7_9.3 will be installed
--> Running transaction check
---> Package bind-license.noarch 32:9.11.4-26.P2.el7_9.3 will be installed
---> Package geoipupdate.x86_64 0:2.5.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================

Package Arch Version Repository Size

Installing:
bind-utils x86_64 32:9.11.4-26.P2.el7_9.3 updates 260 k
Installing for dependencies:
GeoIP x86_64 1.5.0-14.el7 base 1.5 M
bind-libs x86_64 32:9.11.4-26.P2.el7_9.3 updates 157 k
bind-libs-lite x86_64 32:9.11.4-26.P2.el7_9.3 updates 1.1 M
bind-license noarch 32:9.11.4-26.P2.el7_9.3 updates 91 k
geoipupdate x86_64 2.5.0-1.el7 base 35 k

Transaction Summary

Install 1 Package (+5 Dependent packages)

Total download size: 3.1 M
Installed size: 7.5 M
Downloading packages:
(1/6): bind-libs-9.11.4-26.P2.el7_9.3.x86_64.rpm | 157 kB 00:00:00
(2/6): GeoIP-1.5.0-14.el7.x86_64.rpm | 1.5 MB 00:00:00
(3/6): geoipupdate-2.5.0-1.el7.x86_64.rpm | 35 kB 00:00:05
(4/6): bind-license-9.11.4-26.P2.el7_9.3.noarch.rpm | 91 kB 00:00:05
(5/6): bind-libs-lite-9.11.4-26.P2.el7_9.3.x86_64.rpm | 1.1 MB 00:00:06

(6/6): bind-utils-9.11.4-26.P2.el7_9.3.x86_64.rpm | 260 kB 00:00:06

Total 456 kB/s | 3.1 MB 00:00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 32:bind-license-9.11.4-26.P2.el7_9.3.noarch 1/6
Installing : geoipupdate-2.5.0-1.el7.x86_64 2/6
Installing : GeoIP-1.5.0-14.el7.x86_64 3/6
Installing : 32:bind-libs-lite-9.11.4-26.P2.el7_9.3.x86_64 4/6
Installing : 32:bind-libs-9.11.4-26.P2.el7_9.3.x86_64 5/6
Installing : 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64 6/6
Verifying : GeoIP-1.5.0-14.el7.x86_64 1/6
Verifying : 32:bind-license-9.11.4-26.P2.el7_9.3.noarch 2/6
Verifying : geoipupdate-2.5.0-1.el7.x86_64 3/6
Verifying : 32:bind-utils-9.11.4-26.P2.el7_9.3.x86_64 4/6
Verifying : 32:bind-libs-lite-9.11.4-26.P2.el7_9.3.x86_64 5/6
Verifying : 32:bind-libs-9.11.4-26.P2.el7_9.3.x86_64 6/6

Installed:
bind-utils.x86_64 32:9.11.4-26.P2.el7_9.3

Dependency Installed:
GeoIP.x86_64 0:1.5.0-14.el7 bind-libs.x86_64 32:9.11.4-26.P2.el7_9.3
bind-libs-lite.x86_64 32:9.11.4-26.P2.el7_9.3 bind-license.noarch 32:9.11.4-26.P2.el7_9.3
geoipupdate.x86_64 0:2.5.0-1.el7

Complete!
通过dig @114.114.114.114 registry-1.docker.io命令查看所有的可用地址。
2、修改/etc/hosts文件

可以将上述可用的ip以下面这种方式写入:

[root@vwlin docker]# dig @114.114.114.114 registry-1.docker.io

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-26.P2.el7_9.3 <<>> @114.114.114.114 registry-1.docker.io
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 41579
;; flags: qr rd ra; QUERY: 1, ANSWER: 8, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;registry-1.docker.io. IN A

;; ANSWER SECTION:
registry-1.docker.io. 32 IN A 52.20.56.50
registry-1.docker.io. 32 IN A 18.213.137.78
registry-1.docker.io. 32 IN A 18.232.227.119
registry-1.docker.io. 32 IN A 52.1.121.53
registry-1.docker.io. 32 IN A 54.236.131.166
registry-1.docker.io. 32 IN A 34.195.246.183
registry-1.docker.io. 32 IN A 3.211.199.249
registry-1.docker.io. 32 IN A 3.218.162.19

;; Query time: 20 msec
;; SERVER: 114.114.114.114#53(114.114.114.114)
;; WHEN: Wed Feb 10 13:35:10 CST 2021
;; MSG SIZE rcvd: 177

[root@vwlin docker]# vim /etc/hosts

registry-1.docker.io 52.20.56.50
registry-1.docker.io 18.213.137.78
registry-1.docker.io 18.232.227.119

然后进行文件保存,重新执行docker-compose up命令,问题解决。

[root@vwlin docker]# docker-compose up

Building mysql
Step 1/2 : FROM mysql:5.7
Trying to pull repository docker.io/library/mysql ...
5.7: Pulling from docker.io/library/mysql

最后编辑:2021年02月10日 ©著作权归作者所有

发表评论

正在加载 Emoji