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

Support typical enterprise proxy and internal mirrors setup #821

Closed
1 task
rmohta opened this issue Aug 26, 2020 · 9 comments · Fixed by #1210
Closed
1 task

Support typical enterprise proxy and internal mirrors setup #821

rmohta opened this issue Aug 26, 2020 · 9 comments · Fixed by #1210
Assignees
Labels
size/lg Large level of effort status/ready Issue ready to be worked on. type/enhancement Issue that requests a new feature or improvement.
Milestone

Comments

@rmohta
Copy link

rmohta commented Aug 26, 2020

Description

It would be nice (and increase adoption) if pack cli can support typical enterprise proxy and mirror setup.

Proposed solution

Without changing the toml files or re-building images, pack cli should be able to update the URL to download docker images used in buildpacks and stack settings.
For example, http_proxy environment variables are inherited during the build process - but not everything would have to go via http_proxy. It's common for an enterprise to have internal mirrors using Artifactory or Nexus, so that engineers don't have to fiddle with proxy settings for different types of applications used across different tech stacks.

Similar to --env, if we have --docker-mirror-registry or --docker-proxy-registry, which would allow us to provide the prefix that can be used when downloading images.

Describe alternatives you've considered

Re-build sample applications by adding our docker registry.

Additional context

  • This feature should be documented somewhere
@rmohta rmohta added status/triage Issue or PR that requires contributor attention. type/enhancement Issue that requests a new feature or improvement. labels Aug 26, 2020
@jromero
Copy link
Member

jromero commented Aug 27, 2020

I thought I had replied to this...

Images are typically declared including the hostname. A format such as <hostname>/<repo>[(:<tag>|@<hash>)], for example gcr.io/my-org/my-image:latest.

If I'm understanding of how this would work with something like Artifactory's virtual repos or Nexus's proxy...

If a --docker-mirror-registry of artifactory.my-company.org/docker-repo was configured and a request for gcr.io/my-org/my-image:latest was made, the actual request for the image should be artifactory.my-company.org/docker-repo/my-org/my-image:latest. The virtual registry would in turn search one or more registries based on how it's configured.

Ultimately we'd be removing the original <hostname> and replacing it with the --docker-mirror-registry value.

Does that sound right?

Additional references:

@jromero jromero added status/discussion-needed Issue or PR that requires in-depth discussion. and removed status/triage Issue or PR that requires contributor attention. labels Aug 27, 2020
@jromero
Copy link
Member

jromero commented Aug 28, 2020

Another relevant conversation about being able to push to these proxies/mirrors. I suspect this may or may not work depending on the service (artifactory, nexus, harbor).

@rmohta
Copy link
Author

rmohta commented Sep 1, 2020

@jromero Yes. I was hoping this to be independent of the Container Runtime. I was hoping for pack to mutate the image name, before it's sent down to "docker pull" command. If my builder.tom file has cnbs/sample-stack-run:alpine, then based on the flag, pack can have docker pull as as myregistry.com/cnbs/sample-stack-run:alpine and the might have to tag it as original name for rest of the steps to work.

If a --docker-mirror-registry of artifactory.my-company.org/docker-repo was configured and a request for gcr.io/my-org/my-image:latest was made, the actual request for the image should be artifactory.my-company.org/docker-repo/my-org/my-image:latest. The virtual registry would in turn search one or more registries based on how it's configured.

@jromero jromero added this to the 0.15.0 milestone Sep 16, 2020
@jromero
Copy link
Member

jromero commented Sep 16, 2020

This issue was brought up during our working group meeting today. The question as to whether a lower level support already existing came up. After another quick search, it doesn't appear like there is a pre-existing solution for this specific use case within the docker daemon or within GGCR.

@rmohta
Copy link
Author

rmohta commented Sep 30, 2020

Thank You @jromero. I am not sure if I followed the Slack discussion on namespace and additional complexity. Was it related to this ticket?

@jromero jromero modified the milestones: 0.15.0, 0.16.0 Oct 19, 2020
@jromero
Copy link
Member

jromero commented Jan 6, 2021

@dfreilich let's sync up on this

@dfreilich dfreilich modified the milestones: 0.16.0, 0.17.0 Jan 6, 2021
@dfreilich dfreilich modified the milestones: 0.17.0, 0.18.0 Jan 26, 2021
@dfreilich dfreilich added size/lg Large level of effort status/ready Issue ready to be worked on. and removed status/discussion-needed Issue or PR that requires in-depth discussion. labels Jan 27, 2021
@samj1912
Copy link
Member

https://github.com/buildpacks/pack/pull/1088/files might help with this

@abdennour
Copy link

abdennour commented Feb 24, 2021

in addition, I think there is two strategies of registry proxy:

  • pub.example.com/a-repo/a-image:a-tag becomes after proxy like: private.local/a-repo/a-image:a-tag
  • pub.example.com/a-repo/a-image:a-tag becomes after proxy like : private.local/pub.example.com/a-repo/a-image:a-tag
    i think we need to support the first strategy as per how nexus sonatype works.

I am feeling that we will need a config file called .packconf which looks like :

registries-proxy:  
    docker.io: nexus.mycompany.local
    gcr.io: nexus.mycompany.local
mounts:
     ~/.m2:~/.m2
# ....

@dfreilich
Copy link
Member

@abdennour Interesting point! For a config file, we would probably just use the existing pack config, if need be, but that's definitely food for thought.

@jromero jromero modified the milestones: 0.18.0, 0.19.0 Mar 10, 2021
@dwillist dwillist self-assigned this May 14, 2021
@dfreilich dfreilich removed this from the 0.19.0 milestone Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/lg Large level of effort status/ready Issue ready to be worked on. type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants