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 --network in Pulumi Docker v4 using BuilderV1 #837

Closed
uatach opened this issue Nov 9, 2023 · 6 comments · Fixed by #867
Closed

Add support for --network in Pulumi Docker v4 using BuilderV1 #837

uatach opened this issue Nov 9, 2023 · 6 comments · Fixed by #867
Assignees
Labels
4.x.x kind/enhancement Improvements or new features resolution/fixed This issue was fixed

Comments

@uatach
Copy link

uatach commented Nov 9, 2023

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

Similar to #761, the --network flag was removed from docker.DockerBuild which is leaving us pinned at v3.
I also reported this problem in #424 (comment).
For our case specifically, in Google Cloud when building a Docker image that needs a Python package hosted at Artifact Registry, we need credentials that are accessible from the cloudbuild network.

From what I understand reading docker/buildx#175, and specifically docker/buildx#175 (comment), BuildKit won't be adding support for custom networks anytime soon and the workaround needs a hard-coded IP from Google's metadata server to be used with the --add-host flag.
There's also an issue at https://issuetracker.google.com/issues/227640666 that has not been addressed yet.

The other option would be to add the --network flag back, to be used with the BuilderV1.

Affected area/feature

@uatach uatach added kind/enhancement Improvements or new features needs-triage Needs attention from the triage team labels Nov 9, 2023
@uatach
Copy link
Author

uatach commented Nov 9, 2023

I would be happy to implement a solution for this.

@mikhailshilkov
Copy link
Member

I would be happy to implement a solution for this.

That would be great. Do you have a concrete plan how to bring this support to the current V4? If so, let's try to describe it in this issue first.

@mikhailshilkov mikhailshilkov added 4.x.x and removed needs-triage Needs attention from the triage team labels Nov 10, 2023
@uatach
Copy link
Author

uatach commented Nov 10, 2023

@mikhailshilkov no, I don't have a concrete plan.

@guineveresaenger
Copy link
Contributor

I'm actually not sure that the BuilderV1 client option properly supports the --network flag. This is much better implemented in the Buildkit client for Docker and we will need to look at using that client going forward, which is unfortunately not a straightforward drop-in replace.

@uatach
Copy link
Author

uatach commented Jan 14, 2024

The issue at https://issuetracker.google.com/issues/227640666 has been marked as "Fixed" but it's not clear what was fixed or how it's supposed to work now...

Still, I created a new project using Pulumi Docker v4 but, again, when trying to install a Python package from Artifact Registry, it is unable to acquire the credentials from the metadata server...

Following the discussion from docker/buildx#175, it seems that BuildKit now has the --network flag again but it has some DNS resolution problems.

blampe added a commit that referenced this issue Jan 29, 2024
This adds `--network` and `--add-host` options since those are supported
by both builders.

(Other requests like #761 will require more thought, since that
functionality isn't supported in the v1 API we're using right now.)

Two integration tests are included to ensure the behavior with v1 and v2
builders.

While I was in here I also added `platform` as an output.

Fixes #837.
Fixes #862.
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Jan 29, 2024
@uatach
Copy link
Author

uatach commented Apr 23, 2024

I've created a new project using Pulumi Docker v4.5.3 to test the network option but it gave an error:

error: error building image: Error response from daemon: network mode "cloudbuild" not supported by buildkit

I'm not sure what is the problem, if it's related to Pulumi Docker or to the buildkit running on Google Cloud Build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x.x kind/enhancement Improvements or new features resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants