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 NetworkMode to bake target #863

Merged

Conversation

zachary-povey
Copy link
Contributor

Allows specification of network mode in a bake target.

Fixes #848

Signed-off-by: Zachary Povey [email protected]

Allows specification of network mode in a bake target.

Fixes docker#848

Signed-off-by: Zachary Povey <[email protected]>
@tonistiigi
Copy link
Member

I wonder if we should leave it only for compose files for now. Using build --network is discouraged in buildx. Instead you are supposed to use RUN --network inside the dockerfile https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#network-modes-run---networknonehostdefault and allow network entitlement on build. Proposal for entitlements support in bake is in #179

@zachary-povey
Copy link
Contributor Author

zachary-povey commented Nov 29, 2021

@tonistiigi - happy to change it to just compose files, should I do that?

My use case for this is backwards compatibility with docker-compose anyway, it just seemed (from a naive perspective) if something was available to build it should be available via a bake target.

@tonistiigi
Copy link
Member

happy to change it to just compose files, should I do that?

I think so. cc @crazy-max

@crazy-max
Copy link
Member

crazy-max commented Nov 30, 2021

happy to change it to just compose files, should I do that?

I think so. cc @crazy-max

Yes sgtm

@zachary-povey
Copy link
Contributor Author

Ok, thanks both :)

@tonistiigi I've pushed a commit removing support from HCL/JSON files. Did you also want me to remove the ability to specify it via a cmd line override with --set?

bake/bake.go Outdated
Comment on lines 570 to 571
case "network":
t.NetworkMode = &o.Value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you also want me to remove the ability to specify it via a cmd line override with --set?

Yes remove the override for this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok that's done now 👍

@zachary-povey
Copy link
Contributor Author

@tonistiigi @crazy-max - think this is good to go now?

Copy link
Member

@crazy-max crazy-max left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tonistiigi tonistiigi merged commit 7371dda into docker:master Dec 5, 2021
@crazy-max crazy-max added this to the v0.8.0 milestone Jan 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

buildx bake not honouring docker-compose build network mode host
3 participants