我通过拉动和运行注册表图像在我的服务器上创建了自己的私有注册表.
sudo docker run -d -p 5000:5000 registry
Run Code Online (Sandbox Code Playgroud)
之后,我尝试标记一个简单的图像并将其推送到服务器.
sudo docker tag ubuntu:latest localhost:5000/myprivateubuntu
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
Error: Invalid registry endpoint ... Get ... If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add '--insecure-registry localhost:5000' to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/localhost:5000/ca.crt
Run Code Online (Sandbox Code Playgroud)
无论如何知道这是什么问题?
类似于带有镜像的 Docker 私有注册表,但我使用的是 Sonatype Nexus,它类似于Nexus 注册表镜像 docker hub 不起作用,但我也使用安全密码保护的存储库
我为 Docker 守护进程设置了这些设置。
{
"registry-mirrors": [
"https://repo.myprivate.com"
],
"insecure-registries": [],
"debug": true,
"experimental": false
}
Run Code Online (Sandbox Code Playgroud)
但是,当我拉取图像ubuntu并查看网络访问时,我发现它没有访问我的服务器,而是访问了 Docker Hub 服务器。
我猜这是因为我没有为镜像设置身份验证,但我不知道要使用的设置。
我还想避免使用 Nexus 3 进行代理私有 docker 注册表,它会更改图像的名称以添加地址。
要使用代理拉取,我必须做docker pull repo.myprivate.com/library/alpine我想避免的事情。
看起来它首先优先考虑官方存储库,然后再访问注册表镜像。
我尝试的另一件事是使用 Windows 防火墙阻止 IP 地址,但它也不会回退到我的私人存储库。
我们所有可能的 docker 注册表(包括 Artifactory、AWS ECR 和 GitLab)都曾一度遇到过镜像拉取问题。即使 DockerHub 偶尔也会出现问题。
Kubernetes 部署中是否有一种方法可以指定 pod 可以从多个不同的存储库获取映像,以便在其中一个存储库出现故障时可以回退?
如果没有,还有哪些其他解决方案来保持稳定?我见过像 Harbor 和 Trow 这样的东西,但这似乎是对一个简单问题的严厉解决方案。