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

Add support for private Docker registries in Dockerfile #18315

Closed
R0Wi opened this issue Jul 20, 2023 · 2 comments
Closed

Add support for private Docker registries in Dockerfile #18315

R0Wi opened this issue Jul 20, 2023 · 2 comments
Labels
feature: prebuilds feature: workspace-base-image meta: stale This issue/PR is stale and will be closed soon team: team-engine team: workspace Issue belongs to the Workspace team

Comments

@R0Wi
Copy link

R0Wi commented Jul 20, 2023

Is your feature request related to a problem? Please describe

Thanks to #8550, we're already able to use private Docker registries to pull images from in our .gitpod.yml:

image: my.private-registry/my/image:latest

Unfortunately, like stated in the caveats of the current implementation, there's no support for using private registries in Dockerfiles:

with this implementation, private images can only be used directly, not as part of a Dockerfile (i.e. FROM my-private-repo.com/secret-sauce:latest)

Since dev environments are often built with custom Dockerfiles, it would be great to have support for this, too:

.gitpod.Dockerfile

FROM my.private-registry/my/image:latest
RUN apt-get install mypackage
# ...

.gitpod.yml

image:
    file: .gitpod.Dockerfile

Describe the behaviour you'd like

Add support for using private registries in Dockerfiles which are used to built the gitpod container.

Describe alternatives you've considered

Current alternative would be to prebuild the gitpod image and push it to a private registry. This can be quite cumbersome especially when trying new things.

Additional context

If interested in this feature, I'd really like to participate in any way!

@gitpod-community gitpod-community bot added the team: workspace Issue belongs to the Workspace team label Jul 20, 2023
@ChevronTango
Copy link

ChevronTango commented Aug 18, 2023

I'm also keen to see this implemented. My current research suggests it wouldn't take much. There's two schools of thought here depending on your setup:

User Specified creds

A user can specify an environment variable of GITPOD_IMAGE_AUTH which allows them to pass through a .dockerconfig json file that can be used to authenticate with a private registry. This can be done right now so no changes needed.

Instance wide creds

This is where a tweak would need to be made to the image-builder-mk3, but not a big one. If we assume that the .dockerconfig PullSecret contains the creds we want to pass through, then all we need to do is add in the registry domain to the orcestrator, for example:

		ath := reqauth.GetImageBuildAuthFor(ctx, o.Auth, []string{reference.Domain(pbaseref), config.additionalRegistryDomain}, []string{
			reference.Domain(wsref),
		})

Obviously you'd need to do the config changes to allow this to work, but the logic looks mostly there to allow your dockerconfig to be passed through on all builds, and nicely limited to only the registries you would like. I'm almost certainly missing something so doubtless its more complicated in practice.

With all of this, I am very keen to see this implemented at an Instance wide level and not just per user, as this relieves the burden on teams and users having to specify creds that an admin could and should do on their behalf.

Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the meta: stale This issue/PR is stale and will be closed soon label May 22, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: prebuilds feature: workspace-base-image meta: stale This issue/PR is stale and will be closed soon team: team-engine team: workspace Issue belongs to the Workspace team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants