Artifactory bad gateway error

I am trying to use artifactory as a docker registry. But pushing docker images gives a Bad Gateway error.

Following is my nginx configuration

  • How can I listen for signals from Docker in .Net Core Executable?
  • Docker Notary no trust data available
  • Connecting docker-machine to Azure using the generic driver
  • 2 docker containers run in 1 container
  • How to configure multiples ips for apps in docker
  • How to Increase the Speed of Docker Builds While Using Mounted Volumes
  • upstream artifactory_lb {
            server artifactory01.mycomapany.com:8081;
            server artifactory01.mycomapany.com:8081 backup;
            server myLoadBalancer.mycompany.com:8081;
    }
    
    log_format upstreamlog '[$time_local] $remote_addr - $remote_user - $server_name  to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time';
    
    server {
            listen 80;
            listen 443  ssl;
            client_max_body_size 2048M;
            location / {
                    proxy_set_header Host $host:$server_port;
                    proxy_pass http://artifactory_lb;
                    proxy_read_timeout 90;
            }
            access_log /var/log/nginx/access.log upstreamlog;
            location /basic_status {
                    stub_status on;
                    allow all;
                    }
    }
    
    # Server configuration
    
    server {
        listen 2222 ssl default_server;
        ssl_certificate  /etc/nginx/ssl/self-signed/self.crt;
        ssl_certificate_key /etc/nginx/ssl/self-signed/self.key;
        ssl_protocols TLSv1.1 TLSv1.2;
        ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
        ssl_prefer_server_ciphers on;
        ssl_session_cache shared:SSL:10m;
    
        server_name myloadbalancer.mycompany.com;
        if ($http_x_forwarded_proto = '') {
            set $http_x_forwarded_proto  $scheme;
        }
    
        rewrite ^/(v1|v2)/(.*) /api/docker/docker_repo/$1/$2;
        client_max_body_size 0;
        chunked_transfer_encoding on;
        location / {
        proxy_read_timeout  900;
        proxy_pass_header   Server;
        proxy_cookie_path ~*^/.* /;
        proxy_set_header   X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host;
        proxy_set_header    X-Forwarded-Port  $server_port;
        proxy_set_header    X-Forwarded-Proto $http_x_forwarded_proto;
        proxy_set_header    Host              $http_host;
        proxy_set_header    X-Forwarded-For   $proxy_add_x_forwarded_for
        proxy_pass http://myloadbalancer.company.com:8081/artifactory/;
    
        }
    
    }
    

    The docker command I use to push images is

    docker push myloadbalancer:2222/image_name
    

    Nginx error logs show the following error 24084 connect() failed (111: Connection refused) while connecting to upstream, client: internal_ip, server: , request: “GET /artifactory/inhouse HTTP/1.0”, upstream: “http:/internal_ip:8081/artifactory/repo”

    What am I missing?

  • Too many docker mounts
  • How can let docker use my network router to assign dhcp ip to containers easily instead of pipework?
  • How to connect to a docker box running elasticsearch inside a vagrant guest os?
  • PostgreSQL Docker installation how to setup initial database
  • Dockerfile doesn't run the CMD if the ENTRYPOINT isn't finished
  • Can't push an image to ECS Private Registry - no basic auth credentials
  • One Solution collect form web for “Artifactory bad gateway error”

    This can be fixed by changing the proxy pass to point to any of the upstream servers.

    proxy_pass http://artifactory_lb;
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.