How do I resolve a Docker push failure while running on a port other than the default (80/443)?

JFrog Support
2016-10-06 13:35

Sometimes a Docker push operation will fail if you are using a port other than the default (80/443).

This issue can happen when the configuration file of Nginx is missing the port variable ($server_port is only used when you do not use the default for http/https which are 80/443, respectively):

proxy_set_header Host $host:$server_port;


Here is a sample of a working configuration of Nginx:


server {

  listen 5000;

  server_name rdfactory;

  access_log /var/log/nginx/rdfactory-access.log;

  error_log /var/log/nginx/rdfactory-error.log;

  client_max_body_size 0; # disable any limits to avoid HTTP 413 for large   image uploads

  chunked_transfer_encoding on;

  location / {

    proxy_pass http://rdfactory:8081/artifactory/api/docker/docker-local/;

    proxy_set_header Host $host:$server_port;

    proxy_read_timeout 900;

    proxy_set_header Host $http_host; # required for docker client's sake

    proxy_set_header X-Real-IP $remote_addr; # pass on real client's IP

    proxy_set_header X-Forwarded-Proto $scheme;




Please note: Docker's first request is always for an https configuration with “/v1/” in the URL path. Only when this configuration is not found, Docker will try and resolve from http.