1

We are trying up to setup Artifactory in our corporate setup (there is a proxy server in the mix). Nginx, Artifactory and PostgreSQL are running in containers (spun up using JFrog's docker compose example).

But I am unable to successfully login to docker using cli command (docker login). I am getting the following error:

Error response from daemon: Get https://docker.artifactory/v2/: Forbidden

This is my /etc/hosts file:

xx.xx.x.xxx docker-local.artifactory docker-remote.artifactory bintray-docker-remote.artifactory docker-virtual.artifactory docker.artifactory artifactory

This is the artifactory.conf file:

###########################################################
## this configuration was generated by JFrog Artifactory ##
###########################################################

## server configuration
server {

    listen 80 ;
    server_name ~(?<repo>.+)\.artifactory artifactory;

    if ($http_x_forwarded_proto = '') {
        set $http_x_forwarded_proto  $scheme;
    }
    ## Application specific logs
    ## access_log /var/log/nginx/artifactory-access.log timing;
    ## error_log /var/log/nginx/artifactory-error.log;
    rewrite ^/$ /artifactory/webapp/ redirect;
    rewrite ^/artifactory/?(/webapp)?$ /artifactory/webapp/ redirect;
    rewrite ^/(v1|v2)/(.*) /artifactory/api/docker/$repo/$1/$2;
    chunked_transfer_encoding on;
    client_max_body_size 0;
    location /artifactory/ {
    proxy_read_timeout  900;
    proxy_pass_header   Server;
    proxy_cookie_path   ~*^/.* /;
    if ( $request_uri ~ ^/artifactory/(.*)$ ) {
        proxy_pass          http://xx.xx.x.xxx:8081/artifactory/$1;
    }
    proxy_pass          http://xx.xx.x.xxx:8081/artifactory/;
    proxy_set_header    X-Artifactory-Override-Base-Url $http_x_forwarded_proto://$host:$server_port/artifactory;
    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;
    }
}

Other helpful information:

docker info

[root@jprdevops1 source]# docker info
Containers: 42
 Running: 29
 Paused: 0
 Stopped: 13
Images: 28
Server Version: 17.06.2-ee-10
Storage Driver: devicemapper
 Pool Name: docker-253:0-201376616-pool
 Pool Blocksize: 65.54kB
 Base Device Size: 10.74GB
 Backing Filesystem: xfs
 Data file: /dev/loop0
 Metadata file: /dev/loop1
 Data Space Used: 4.668GB
 Data Space Total: 107.4GB
 Data Space Available: 54.84GB
 Metadata Space Used: 8.266MB
 Metadata Space Total: 2.147GB
 Metadata Space Available: 2.139GB
 Thin Pool Minimum Free Space: 10.74GB
 Udev Sync Supported: true
 Deferred Removal Enabled: true
 Deferred Deletion Enabled: true
 Deferred Deleted Device Count: 0
 Data loop file: /var/lib/docker/devicemapper/devicemapper/data
 Metadata loop file: /var/lib/docker/devicemapper/devicemapper/metadata
 Library Version: 1.02.146-RHEL7 (2018-01-22)
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host macvlan null overlay
 Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: active
 NodeID: 73zg9m9we01buq3gvkf3zwh9t
 Is Manager: true
 ClusterID: ybotbith447qdwu5fjvkitb0a
 Managers: 1
 Nodes: 3
 Orchestration:
  Task History Retention Limit: 5
 Raft:
  Snapshot Interval: 10000
  Number of Old Snapshots to Retain: 0
  Heartbeat Tick: 1
  Election Tick: 10
 Dispatcher:
  Heartbeat Period: 5 seconds
 CA Configuration:
  Expiry Duration: 3 months
  Force Rotate: 0
  External CAs:
    cfssl: https://xx.xx.x.xxx:12381/api/v1/cfssl/sign
 Root Rotation In Progress: false
 Node Address: xx.xx.x.xxx
 Manager Addresses:
  xx.xx.x.xxx:2377
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 462c82662200a17ee39e74692f536067a3576a50
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 3.10.0-693.21.1.el7.x86_64
Operating System: Red Hat Enterprise Linux Server 7.4 (Maipo)
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 15.51GiB
Name: jprdevops1
ID: CQEY:6LPH:YT2U:EHNG:KDSZ:QH7L:2EOM:2HYH:JF4P:HPNB:4CF3:FCDU
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Http Proxy: http://xx.xx.xx.xx:80/
Https Proxy: https://xx.xx.xx.xx:80/
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

WARNING: devicemapper: usage of loopback devices is strongly discouraged for production use.
         Use `--storage-opt dm.thinpooldev` to specify a custom block storage device.

docker version:

Client: Docker Enterprise Edition (EE) 2.0
 Version:       17.06.2-ee-10
 API version:   1.30
 Go version:    go1.8.7
 Git commit:    66261a0
 Built: Fri Apr 27 00:38:41 2018
 OS/Arch:       linux/amd64

Server: Docker Enterprise Edition (EE) 2.0
 Engine:
  Version:      17.06.2-ee-10
  API version:  1.30 (minimum version 1.12)
  Go version:   go1.8.7
  Git commit:   66261a0
  Built:        Fri Apr 27 00:40:03 2018
  OS/Arch:      linux/amd64
  Experimental: false

What I tried?

•   Docker proxies are configured correctly in docker.service.d dir (as per documentation procedure)

•   Proxy information is also set in Artifactory (Admin -> Configuration -> Proxies)

•   Added Google's public dns server details in /etc/resolv.conf

•   Restarted the docker daemon

•   Added self signed cert to /etc/pki and updated ca certs.

I am really exhausted and have hit a dead end. Need guidance on successfully logging in to docker using CLI.

Regards

Aditya

CK5
  • 1,055
  • 3
  • 16
  • 29
  • The request to docker.artifactory is https. The config you showed us is only http. Is there another config to look at? Or perhaps, try configuring the insecure registries with "docker.artifactory". – Rickkwa Aug 22 '18 at 03:25
  • @Rickkwa port 443 is used by another service. Can we use port 8443 instead? – CK5 Aug 22 '18 at 06:15
  • I think @Rickkwa is on the right track. This seems like an Artifactory+Nginx config issue. – Matthew Schuchard Aug 22 '18 at 14:23
  • @Rickkwa I have added listen ssl 443 in the nginx.conf but still I am getting forbidden request. I know something is broken somewhere, but I don't know where is it. – CK5 Aug 23 '18 at 05:44
  • @AdityaKrishnakant Can you update the question with the new nginx conf? Also, I'm not at all familiar with Artifactory so idk how much help I can be. – Rickkwa Aug 24 '18 at 00:43

0 Answers0