build dockerfile 报错TLS handshake timeout:详情如下
sniper:docker chris$ docker build -t hello_docker .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM alpine:latest
latest: Pulling from library/alpine
ff3a5c916c92: Pulling fs layer
error pulling image configuration: Get https://dseasb33srnrn.cloudfront.net/registry-v2/docker/registry/v2/blobs/sha256/3f/3fd9065eaf02feaf94d68376da52541925650b81698c53c6824d92ff63f98353/data?Expires=1523738136&Signature=GGO8hMm1ynJNw9ErJWM94xUBscpWHAGw38i5mNW1W69nVcfoIP43~rdAuwLfxXeHfTXnO0HVXdSfxwCkO7VskyJKVMtZmWIjTCkoZqhLppz3sn30cvBvxtzCCLZAuWCM60e51UAgMqMbss4EKL5J4gxb8gKvtYcHqNG0lTSMBt0_&Key-Pair-Id=APKAJECH5M7VWIS5YZ6Q: net/http: TLS handshake timeout
TLS handshake timeout的原因是从dockerhub拉取镜像失败,需要做一个加速,加速器可以用国内的阿里加速器,注册一个阿里云的账号,获取自己的专属加速地址。

右键点击桌面顶栏的 docker 图标,选择 Preferences ,在 Daemon 标签(Docker 17.03 之前版本为 Advanced 标签)下的 Registry mirrors 列表中将你的专属加速地址加到"registry-mirrors"的数组里,点击 Apply & Restart按钮,等待Docker重启并应用配置的镜像加速器。
成功解决:

网友评论