在虚拟服务器ubuntu 14.04上我安装了docker,我尝试将一个映像推送到本地注册表。 我跟着this guide on the Docker blog但是当我尝试推送图像时,我有这个输出:
错误:无效的注册表端点https://xx.xx.xx.xx/v1/:获取https://xx.xx.xx.xx/v1/_ping:x509:证书已过期或尚未生效。如果此私有注册表仅支持具有未知CA证书的HTTP或HTTPS,请将
--insecure-registry xx.xx.xx.xx
添加到守护程序的参数中。对于HTTPS,如果您可以访问注册表的CA证书,则不需要该标志;只需将CA证书放在/etc/docker/certs.d/xx.xx.xx.xx/ca.crt
我尝试在--insecure-registry xx.xx.xx.xx
文件中添加/etc/default/docker
并重新启动docker服务。
Docker无法以消息/proc/self/fd/9: 17: /etc/default/docker: --insecure-registry: not found
开始。
PS:我在docker容器中运行我的注册表
答案 0 :(得分:7)
我遇到了与Ubuntu 12.04和Docker 1.4.1相同的问题。这是我的解决方案:
$ sudo docker push "[host:ip:v6:addr:ess:is:here]:5000/myImage"
FATA[0002] Error: Invalid registry endpoint https://[host:ip:v6:addr:ess:is:here]:5000/v1/: Get https://[host:ip:v6:addr:ess:is:here]:5000/v1/_ping: EOF. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add `--insecure-registry [host:ip:v6:addr:ess:is:here]: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/[host:ip:v6:addr:ess:is:here]:5000/ca.crt
所以,我有一个错误。
$ ps axwww | grep /usr/bin/docker
14655 ? Ssl 2:06 /usr/bin/docker -d
14869 pts/0 S+ 0:00 grep /usr/bin/docker
请注意,/ usr / bin / docker没有额外的参数。
$ echo 'DOCKER_OPTS="--insecure-registry [host:ip:v6:addr:ess:is:here]:5000"' | sudo tee -a /etc/default/docker
DOCKER_OPTS="--insecure-registry [host:ip:v6:addr:ess:is:here]:5000"
$ sudo service docker restart
docker stop/waiting
docker start/running, process 15615
让我们检查是否出现了参数:
$ ps axwww | grep /usr/bin/docker
15615 ? Ssl 0:00 /usr/bin/docker -d --insecure-registry [host:ip:v6:addr:ess:is:here]:5000
15663 pts/0 S+ 0:00 grep /usr/bin/docker
是的,他们这样做。还有一次尝试:
$ sudo docker push "[host:ip:v6:addr:ess:is:here]:5000/myImage"
The push refers to a repository [[host:ip:v6:addr:ess:is:here]:5000/myImage] (len: 1)
Sending image list
Pushing repository [host:ip:v6:addr:ess:is:here]:5000/myImage (1 tags)
511136ea3c5a: Image successfully pushed
27d47432a69b: Pushing [================================================> ] 189.8 MB/197.2 MB 0
答案 1 :(得分:2)
只需运行此docker run -p 5000:5000 -d registry
即可让您解决https问题。
我发现本教程很有用:How To Set Up a Private Docker Registry on Ubuntu 14.04
它基本上设置了一个使用nginx的反向代理来访问私有注册表。我有1个带有注册表的流浪盒和一个不同的流浪盒从这个注册表中提取东西。它有效:)
希望有所帮助
答案 2 :(得分:0)
直接在主机上设置docker注册表非常令人沮丧。 设置本地docker存储库的最简单方法是使用docker-registry docker镜像。 只需执行
即可docker run -p 5000:5000 -d registry
和docker应该下载官方的docker注册表图像。 之后,您可以附加到容器并自定义设置。 资源: http://www.devops-insight.com/2014/12/using-private-docker-repository-registry.html
答案 3 :(得分:0)
在主持人中
1- install docker machin
curl -L https://github.com/docker/machine/releases/download/v0.14.0/docker-machine-`uname -s`-`uname -m` >/tmp/docker-machine && \
sudo install /tmp/docker-machine /usr/local/bin/docker-machine
2- Remove any proxy entry in /etc/systemd/system/docker.....
3- Edit the daemon.json file, whose default location is /etc/docker/daemon.json
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}
4- Generate crt:
$mkdir -p certs
$openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/domain.key -x509 -days 365 -out certs/domain.crt
Be sure to use the same name myregistrydomain.com as a CN.
Copy the domain.crt file to /etc/docker/certs.d/myregistrydomain.com:5000/ca.crt on every Docker host. You do not need to restart Docker.
5- pull registry image from docker hub
docker run -p 5000:5000 --name myregistry registry
在客户端
1- Remove any proxy entry in /etc/systemd/system/docker.....
2- Edit the daemon.json file, whose default location is /etc/docker/daemon.json
{
"insecure-registries" : ["myregistrydomain.com:5000"]
}