Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

login subcommand does not respect URL path, unlike registry which has url prefix setting. #3255

Open
alexanderankin opened this issue Aug 16, 2021 · 3 comments

Comments

@alexanderankin
Copy link

Description

A docker registry using the distribution project can be configured with a url prefix instead of "/". this then makes it impossible to log in because the

Here's someone facing the same issue.

Steps to reproduce the issue:

  1. start private registry with this config (http.prefix) set to /test, this can be done with a simple docker run command, as these variables are all also read from env vars.
  2. run docker login localhost:5001/test and
  3. notice that requests are coming on on localhost:5001/v2 and not localhost:5001/test/v2

Describe the results you received:

as described in #190, the url is simply cut off and then you can never reach the endpoint you need to continue.

Describe the results you expected:
I expected this software to behave like this one, which, for example, will request 2 different /.well-known urls before giving up. the one at the root, ./well-known, and then /the/path/given/as/argument/.well-known.

Additional information you deem important (e.g. issue happens only occasionally):

Output of docker version:

Docker version 19.03.12, build 48a66213fe

Output of docker info:

expand
Client:
 Debug Mode: false

Server:
 Containers: 9
  Running: 1
  Paused: 0
  Stopped: 8
 Images: 29
 Server Version: 19.03.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
 init version: fec3683
 Security Options:
  apparmor
  seccomp
   Profile: default
 Kernel Version: 5.4.0-80-generic
 Operating System: Ubuntu 20.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.55GiB
 Name: tb1-Latitude-3440
 ID: VO74:Z6HH:U4JV:2B6T:YAWD:DVZA:Z3RX:SL37:WUA2:G7IT:O3BA:5BIW
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No swap limit support

Additional environment details (AWS, VirtualBox, physical, etc.):

physical. (registry is running in the cloud, its proxied behind nginx, which is where i am seeing the urls it is requesting.

@c-romeo
Copy link

c-romeo commented Sep 7, 2021

Facing same issue.
From what I've checked there isn't support in docker login cli command for Url. When using private registry is taking the domain name no matter the url address passed as argument.

@thaJeztah
Copy link
Member

correct, credentials are stored on a per-host base (so there's no option to store credentials per-path). I recall some discussion around this in the containerd project, and (AFAIK) the current OCI distribution spec requires the /v2/xxx endpoints to be at the root; https://github.com/opencontainers/distribution-spec/blob/v1.0.0/spec.md#api. I'm not familiar with the background on the configuration option in the "distribution" project (it may have been implemented for situations to allow the registry to be hosted on a path, but behind a proxy that rewrites paths).

@Valgueiro
Copy link

Hello guys,

I know this bug has been sitting for a long time, but do we have any updates or workarounds for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants