docker拉取mysql镜像速度很慢

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37674858/article/details/79978337

1. 直接通过docker拉取镜像遇到的问题:熟悉的timeout!!!

sysuygm@sysuygm:~$ docker pull mysql:5.7
5.7: Pulling from library/mysql
85b1f47fba49: Pulling fs layer 
5671503d4f93: Download complete 
3b43b3b913cb: Download complete 
4fbb803665d0: Waiting 
05808866e6f9: Waiting 
1d8c65d48cfa: Waiting 
e189e187b2b5: Waiting 
02d3e6011ee8: Waiting 
2d0f3914273e: Waiting 
b7de9fbb86ba: Waiting 
error pulling image configuration: Get https://registry-1.docker.io/v2/library/mysql/blobs/sha256:dd0afb9bc4a99c70cdda8002ef2f1816405a795ee28faa0debd633f3380f8c4c: dial tcp 34.225.121.244:443: i/o timeout

sysuygm@sysuygm:~$ docker pull mysql:5.7
Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/5.7: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fmysql%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

sysuygm@sysuygm:~$ docker pull mysql:5.7
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

sysuygm@sysuygm:~$ docker pull mysql:5.7
5.7: Pulling from library/mysql
Get https://registry-1.docker.io/v2/library/mysql/manifests/sha256:94ed2fa3857cc98ec8d680aedfd5a05ea5a3ea954f062edbdc0443d0f53a428e: dial tcp 54.152.209.167:443: i/o timeout

sysuygm@sysuygm:~$ docker pull mysql:5.7
Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/5.7: dial tcp 34.200.28.105:443: i/o timeout

sysuygm@sysuygm:~$ docker pull mysql:5.7
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

sysuygm@sysuygm:~$ docker pull mysql:5.7
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

sysuygm@sysuygm:~$ docker pull mysql:5.7
Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/5.7: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fmysql%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

2. 通过国内镜像daocloud.io/library库下载,下载速度快到感人!

sysuygm@sysuygm:~$     docker pull daocloud.io/library/centos:latest
latest: Pulling from library/centos
d9aaf4d82f24: Downloading [>                                                  ]  526.4kB/73.39MB
^C
sysuygm@sysuygm:~$  docker pull daocloud.io/library/mysql:5.7
5.7: Pulling from library/mysql
85b1f47fba49: Pull complete 
5671503d4f93: Pull complete 
3b43b3b913cb: Pull complete 
4fbb803665d0: Pull complete 
05808866e6f9: Pull complete 
1d8c65d48cfa: Pull complete 
e189e187b2b5: Pull complete 
02d3e6011ee8: Pull complete 
d43b32d5ce04: Pull complete 
2a809168ab45: Pull complete 
Digest: sha256:a0423a7d021b7a7775f1d2db1014bd15fde029f538c1f8d97c9832aa4a25209f
Status: Downloaded newer image for daocloud.io/library/mysql:5.7

sysuygm@sysuygm:~$ docker images
REPOSITORY                  TAG                 IMAGE ID            CREATED             SIZE
hello-world                 latest              f2a91732366c        2 weeks ago         1.85kB
daocloud.io/library/mysql   5.7                 5709795eeffa        5 weeks ago         408MB
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23

需要注意的是:mysql镜像名的前缀不能忘记,否则报错! 
完整的名字: daocloud.io/library/mysql:5.7

sysuygm@sysuygm:~$ docker run -p 3306:3306 --name mysql2 -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7
Unable to find image 'mysql:5.7' locally

docker: Error response from daemon: Get https://registry-1.docker.io/v2/library/mysql/manifests/5.7: Get https://auth.docker.io/token?scope=repository%3Alibrary%2Fmysql%3Apull&service=registry.docker.io: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers).
See 'docker run --help'.
sysuygm@sysuygm:~$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

sysuygm@sysuygm:~$ docker run -it --net host daocloud.io/library/mysql:5.7 "sh"
# mysql -h127.0.0.1 -P3306 -uroot -proot
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
阅读更多

没有更多推荐了,返回首页