Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker push to private registry: how not to specify a port

When deploy a private registry per this docker instructions, I have to specify the port in CLI to push the image like this:

For http(80), the command is: docker push host.com:80/alpine. For https(443), the command has to be: docker push host.com:443/alpine. If I mapped the port to 5000, the command is: docker push host.com:5000/alpine.

The desired effect is a simple push like this: docker push host.com/alpine

How do I construct the docker run full command to achieve this when I start registry-container?

like image 443
robert Avatar asked Nov 08 '22 20:11

robert


1 Answers

Default port is 443, as far as I know, it can't be changed. But you can setup NGINX(or HAProxy) on another host and configure it to proxy all your requests to your registry, something like this:

server {
  listen *:443 ssl;
  server_name registry.company.com;
  proxy_set_header Host upload.expert;
  location / {
    proxy_pass http://private.registry.company.com:5000;
  }
}

And then just docker push registry.company.com/alpine

like image 93
sergkondr Avatar answered Nov 15 '22 06:11

sergkondr