Docker Pull 使用 TLS 连接校验镜像源

在使用 docker pull 命令从私有镜像仓库拉取镜像时,我们通常需要进行 TLS 连接校验以确保安全。此前,一些旧版本 Docker 使用 --tls-verify--tlscacert 等参数进行配置,但这些参数在新版本中已被弃用。

错误的命令:

docker pull --tls-verify 
docker pull --tls --tlscacert=/path/to/ca.pem --tlscert=/path/to/cert.pem --tlskey=/path/to/key.pem registry.example.com/image:tag
docker pull --tlsverify --tlscacert=/path/to/ca.pem --tlscert=/path/to/cert.pem --tlskey=/path/to/key.pem registry.example.com/image:tag

正确的命令:

docker pull --tlsverify --cert=/path/to/cert.pem --key=/path/to/key.pem --cacert=/path/to/ca.pem registry.example.com/image:tag

参数说明:

  • --tlsverify: 启用 TLS 验证。
  • --cert: 指定客户端证书路径。
  • --key: 指定客户端私钥路径。
  • --cacert: 指定 CA 证书路径。
  • registry.example.com/image:tag: 要拉取的镜像地址。

注意:

  • 请将上述路径替换为实际的证书和密钥文件路径。
  • 确保您的 Docker 客户端版本支持上述命令和参数。
Docker Pull 使用 TLS 连接校验镜像源

原文地址: https://www.cveoy.top/t/topic/jmwT 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录