docker registry with --insecure-registry and docker 1.5

不想你离开。 提交于 2021-02-10 06:17:50

问题


I have an issue with docker 1.5.

So, I run a private registry at myregistry:5000. I can push & pull from an other location (debian 7 & docker 1.4) with :

DOCKER_OPTS="--insecure-registry myregistry:5000"

in /etc/default/docker

Now, I have a new system with docker 1.5 and debian 8, it's not working anymore. I tried all possibilities like, --insecure-registry=myregistry:5000 or --insecure-registry http://myregistry:5000

Any clue?

(Note : It works well if I stop docker and launch docker -d --insecure-registry myregistry:5000 )


回答1:


If it can help anyone, I think the problem not coming from Docker, (I tried to update my registry with no success) but from systemd start command.

So, it's not a clean solution, but it still cleaner than launching docker in a screen.

I modify /lib/systemd/system/docker.service and change the ExecStart line :

ExecStart=/usr/bin/docker --insecure-registry myregistry:5000 -d -H fd://

Then, systemctl daemon-reload systemctl restart docker

And that's it. It works. I can pull & push to my distant private registry.




回答2:


I faced with the same issue on Debian 9 and Docker Se 18.06.1-ce. I have got an error message:

Using default tag: latest
Error response from daemon: Get https://mydocker-hub:5000/v2/: http: server gave HTTP response to HTTPS client

You can solve the problem in different ways.

  1. You can create a file (or modify) /etc/docker/daemon.json and add into it following strings:

    { "insecure-registries": ["yourdocker-hub:5000"] }
    

    Restart the docker service: service docker restart

  2. You can modify /etc/default/docker and edit DOCKER_OPTS option

    DOCKER_OPTS='--insecure-registry yourdocker-hub:5000'
    

    Restart the docker service: service docker restart

  3. Also, you can modify a file /lib/systemd/system/docker.service and add --insecure-registry yourdocker-hub:5000 to command line of service

    [Service]        
    ExecStart=/usr/bin/dockerd -H fd:// --insecure-registry yourdocker-hub:5000
    

    Now you need to reload systemd manager configuration, run: systemctl daemon-reload
    Restart the docker service: service docker restart

  4. You can stop the docker service and start it manually with options.

    service docker stop
    docker -d yourdocker-hub:5000
    

If you get an error, see your /var/log/syslog file.




回答3:


I use Docker 1.5 on Ubuntu Utopic 14.10 with own Docker Registry server on 5000 port. Everything works well. There are some additional options in my /etc/default/docker file that probably will make no sense for your situation. Just see how the local registry is enabled:

DOCKER_OPTS="--debug --log-level=\"debug\" --dns 172.17.42.1 --insecure-registry 172.16.99.67:5000"

Reboot your computer after config changes.



来源:https://stackoverflow.com/questions/29430024/docker-registry-with-insecure-registry-and-docker-1-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!