Reputation: 21
service:
docker service create --name registry --secret domain.crt --secret domain.key --constraint 'node.labels.registry==true' --mount type=volume,src=registry-data,dst=/var/lib/registry --mount type=bind,src=/etc/docker/auth,dst=/auth -e REGISTRY_HTTP_ADDR=0.0.0.0:443 -e REGISTRY_HTTP_TLS_CERTIFICATE=/run/secrets/domain.crt -e REGISTRY_HTTP_TLS_KEY=/run/secrets/domain.key -e "REGISTRY_AUTH=htpasswd" -e "REGISTRY_AUTH_HTPASSWD_REALM=Registry Realm" -e REGISTRY_AUTH_HTPASSWD_PATH=/auth/htpasswd --publish published=443,target=443 --replicas 1 registry:2
login:
docker login lcy_docker1.example
Username: admin
Password:
Login Succeeded
push:
docker tag hello-world lcy_docker1.example/hello-world
docker push lcy_docker1.example/hello-world
# The push refers to repository [lcy_docker1.example/hello-world]
# Get https:///v2/: http: no Host in request URL
Why can't push to my private registry?
Upvotes: 2
Views: 2192
Reputation: 155
try to remove "_" underscore string from domain. lcy_docker1.example -> lcydocker1.example
https://github.com/moby/moby/issues/34975
Upvotes: 1
Reputation: 777
The problem is you didnt put the Host entry for lcy_docker1.example from where you are pushing the image. Also make sure that while tagging image specify the registry port also. eg: docker run -t -i ubuntu /bin/bash docker tag ubuntu 52.203.56.158:5000/ubuntu:v3 docker push 52.203.56.158:5000/ubuntu:v3
Upvotes: 0