解决: Error response from daemon: Get https://registry.docker.xxx.com/v1/_ping: x509: certificate

Docker version 17.04.0-ce, centos 7

从公司 docker 仓库 pull 镜像的时候报 x509: certificate signed by unknown authority.

查了一下, 网上说设置 docker insecure_registry便可解决. 但是按照官网设置DOCKER_OPTS="--insecure-registry registry.docker.xxx.com", 重启docker没用.

最后通过添加私有证书到 docker 解决. 步骤:

  1. 导出证书. 用 https 打开 registry 并将证书导出: https://registry.docker.xxx.com. 我用的火狐, 提示证书不受信任, 点击"高级","添加例外","查看", 在"详情"标签页, 有一个"导出"按钮. 导出一个后缀名为crt或者cer的证书.
  2. 将证书添加到docker.
    • 首先在/etc/docker/certs.d/目录下创建registry.docker.xxx.com的目录.
    • 然后将证书拷贝到registry.docker.xxx.com目录下. 并且将证书重命名为ca.crt或者ca.cer. 注意, 后缀名不重要, 名字一定要是ca.
    • 重启docker即可. systemctl restart docker.service

参考链接:
https://docs.docker.com/registry/insecure/#using-self-signed-certificates

转载于:https://my.oschina.net/u/1169457/blog/886354

你可能感兴趣的:(解决: Error response from daemon: Get https://registry.docker.xxx.com/v1/_ping: x509: certificate)