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

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

AuthorFullName__c
JFrog Support
articleNumber
000001195
ft:sourceType
Salesforce
FirstPublishedDate
2016-10-06T13:35:23Z
lastModifiedDate
2021-02-03
VersionNumber
4

Sometimes a Docker push operation will fail if you are using a port other than the default (80/443).This issue can arise when your Nginx configuration file is missing the port variable (i.e., the $server_port is only used when you’re not using the defaults for http/https, which are 80 or 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;

  }

}