vscode-docker icon indicating copy to clipboard operation
vscode-docker copied to clipboard

Support third-party registries

Open StephenWeatherford opened this issue 5 years ago • 30 comments

Specifically requested (but goal is generic support), in no particular order:

Open:

  • [ ] goharbor.io (see #878, #3449)
  • [ ] ECR (Amazon, see #3202, #3604)
  • [ ] GCR (Google) (+3 see #394, #2890)
  • [ ] quay.io (+4 see #390)
  • [ ] DTR (Enterprise Docker trusted registry) (see #3325)
  • [ ] Cloudsmith (see #1887)
  • [ ] Aliyun (see #1964)
  • [ ] Portus (see #2735)
  • [ ] Digital Ocean (see #2879)

Blocked on no/partial Registry V2 support:

  • [ ] V2 registries that don't use /v2/ endpoint (see #3562)
  • [ ] GitHub (see #1525, #1938)
  • [ ] GitLab self-hosted (+5 see #1832, #2457, #2735, #3119, #3271)
  • [ ] harbor.korporate.org (see #1927)
  • [ ] GitLab Groups (see #1970)

Done:

  • [x] DockerHub
  • [x] Azure
  • [x] GitLab (+25-ish see #162)
  • [x] Generic V2 registry (+2)

StephenWeatherford avatar Mar 27 '19 22:03 StephenWeatherford

while connecting using private registry option, is private Docker DTR (Enterprise Docker trusted registry) supported at all?

gauravlakhani avatar Apr 17 '19 18:04 gauravlakhani

@gauravlakhani Support for registries beyond Docker Hub is fairly new, we haven't tested on DTR. I've added it to the list.

StephenWeatherford avatar Apr 17 '19 18:04 StephenWeatherford

@here champion!

shaneholloman avatar Jun 11 '19 14:06 shaneholloman

Hi, do we have an estimated date for this to complete?

imkhairulikhwan avatar Jan 20 '20 22:01 imkhairulikhwan

Following this...

Nhimself avatar Feb 21 '20 11:02 Nhimself

@BigMorty I think that we should take this one for 1.1...

bwateratmsft avatar Feb 21 '20 14:02 bwateratmsft

Agree we should try to get it into 1.1 or 1.2

BigMorty avatar Feb 21 '20 23:02 BigMorty

This could potentially require and/or take advantage of https://github.com/microsoft/vscode/issues/88309

bwateratmsft avatar Feb 24 '20 18:02 bwateratmsft

I've spent a lot of time researching in the past few days. Unfortunately this is going to be extremely difficult, due to two main issues:

  1. No / incomplete Registry V2 API support
    • GitHub, Docker Hub lack the _catalog endpoint
    • GitLab has no V2 API support at all, but instead a custom API
    • ~~DTR has no V2 API; or at least I can't find any docs suggesting it does~~ Looks like DTR might: https://success.docker.com/article/how-do-i-use-api-v2-with-dtr
  2. OAuth flows totally inconsistent with each other and with the spec
    • Azure and Quay require a web page sign-in
    • Docker Hub has a hilariously broken auth flow--it issues tokens regardless of anything (though the tokens will not work), and does not issue refresh tokens even when asked for them, and does not accept POST's for OAuth tokens like the spec says
    • GCR and ECR use credential helpers--not something we can use easily
    • Quay requires the users to create a client application, and provide its ID to any clients (e.g. this extension). Possible, but onerously difficult.
    • goharbor.io might be the only one with a proper implementation that also permits password auth? At least, their docs sound like it.

Implementing support for each registry with their own custom APIs is a non-starter. Dealing with the OAuth flows is possible, but guaranteed to result in a lot of bad user experiences, due to the complexity and prerequisite setup that most of them demand.

bwateratmsft avatar Feb 27 '20 16:02 bwateratmsft

I stumbled upon this in our company. Our setup is basic docker registry instance as container via image registry:2 image id 708bc6af7e5e while Oauth2 authentication is handled by second container via cesanta/docker_auth:latest image id dd1aae63f028 with some kind of OpenLdap in background.

Most of tools which I have used can handle this combination well as it implements basic Oauth2 flow without redirects to web UI or other magical stuff. For us standard Oauth2 support would be enough.

kautkata avatar Mar 04 '20 16:03 kautkata

@kautkata I'd love to learn more about your setup and see if we can get support added. registry:2 OAuth is a starting point that would help a lot of folks.

Do you have any setup guides on what you have? When doing docker login from the command line, what do you use for username/password? I've seen options of actual password, PAT, OAuth token, and more...

bwateratmsft avatar Mar 04 '20 17:03 bwateratmsft

@bwateratmsft Here you go.

Registry and auth endpoint configuration files are modified (you know I'm not supposed to expose our internal details and stuff) but in general they still should work. TLS certificates are pretty basic, they where generated via openssl command line tools.

From docker container perspective it looks like this: dockerps.txt

Registry container gets started via: /usr/bin/docker run --name registry --mount type=bind,source=/etc/docker-registry,destination=/cfg,readonly --mount type=bind,source=/mnt1/docker/registry,destination=/var/lib/registry -p 443:443 registry:2 /cfg/config-registry.yml

Auth endpoint gets started via: /usr/bin/docker run --name registry-auth --mount type=bind,source=/etc/docker-registry,destination=/cfg,readonly -p 442:442 cesanta/docker_auth:latest -logtostderr /cfg/config-auth.yml

Registry configuration file: config-registry.yml

Auth endpoints configuration file: config-auth.yml

On server /etc/docker-registry directory contains following files: config-auth.yml config-registry.yml ldap_password server-cert.pem server-key.pem

From ldap users perspective using docker daemon running on Linux it works as a charm via:

docker login -u <ldap username> docker.internaldomain.lv
Password:
WARNING! Your password will be stored unencrypted in /home/<os user>/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

Afterwards specified OpenLDAP user can push images to registry, example: docker.internaldomain.lv/user/<ldap user name>/test:latest

PS. Auth endpoints project https://github.com/cesanta/docker_auth

kautkata avatar Mar 05 '20 06:03 kautkata

This is great info, thanks a ton @kautkata. I'll be spending some time in the 1.1 release looking into this to see what we can do.

bwateratmsft avatar Mar 05 '20 14:03 bwateratmsft

+1, GCR support would be very nice to have

fathom-matthew avatar Mar 10 '20 18:03 fathom-matthew

@fathom-matthew @Nhimself @imkhairulikhwan (I @'d you all since you have commented recently :smile:):

GCR, ECR, and Quay all require some extra setup (each needs work done in their respective portals; GCR and ECR also require installing their respective command-line utilities). What do you guys think would be the best user experience to enable these registries but still set users up for success by getting them through the necessary setup?

bwateratmsft avatar Mar 12 '20 16:03 bwateratmsft

Linking to #2033 so those subscribed to this issue can see that.

bwateratmsft avatar Jun 01 '20 14:06 bwateratmsft

@bwateratmsft how does the new GitHub registry fit into the picture?

I was looking for some details esp. around RegistryV2 support, but from what GitHub has on their website I can't really say if full V2 protocol is supported...

karolz-ms avatar Sep 07 '20 00:09 karolz-ms

Pretty sure the "new" GitHub registry is just the existing GitHub registry but "relaunched" to draw more attention and with a few additional features not relevant to us. It's V2 compliant minus the _catalog endpoint. In the new extensibility model I'm making such monolith registries possible to connect to but it will require adding each repository manually since there's no way to list repositories.

bwateratmsft avatar Sep 08 '20 14:09 bwateratmsft

+1 for Gitlab self-hosted

ZeeMoros avatar Dec 08 '20 15:12 ZeeMoros

@bwateratmsft Any update on GCR? They have a bit more documentation and are at least Docker CLI compatible. https://docs.github.com/en/free-pro-team@latest/packages/guides/connecting-a-repository-to-a-container-image

JustinGrote avatar Jan 12 '21 01:01 JustinGrote

@JustinGrote We had been underway on a more generic and extensible registry provider model but it got shelved. I'm not sure what priorities will be coming up this year so I can't say what to expect.

bwateratmsft avatar Jan 12 '21 14:01 bwateratmsft

+1 for gitlab self-hosted registries

aarontcannon avatar Apr 11 '21 02:04 aarontcannon

Any update for the ECR and GCR?

vivekrp avatar Sep 01 '21 08:09 vivekrp

Any update for the ECR and GCR?

@vivekrp We're working on a proposal for registry extensibility that would make it simple to add providers: #2033

We'd definitely be interested in your feedback on it!

bwateratmsft avatar Sep 01 '21 12:09 bwateratmsft

+1 for Gitlab self-hosted

quicktrick avatar Feb 13 '22 11:02 quicktrick

+1 for Gitlab self-hosted

julian-poidevin avatar Mar 09 '22 15:03 julian-poidevin

+1 Github Container Registry,

the github contact @Phanatic in #1525 seems to have moved on with no response, the thread locked (only for contributors)

I've posted requesting an update here (is there a github issue for this?) https://github.community/t/ghcr-io-docker-http-api/130121/2

elasticdotventures avatar Jun 07 '22 00:06 elasticdotventures

I would like to add that the docker image registry built into Gitea: Gitea Container Registry also does not contain endpoint /v2/.

Aleksei-Badyaev avatar Jul 07 '22 13:07 Aleksei-Badyaev

+1 for Gitlab self-hosted

KevinPoole avatar Aug 05 '22 20:08 KevinPoole

+1 for Gitlab self-hosted

yaroslavsadin avatar Sep 20 '22 20:09 yaroslavsadin