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

dockerfile: allow named context for docker-image://scratch #3130

Merged
merged 1 commit into from
Sep 30, 2022

Conversation

jedevc
Copy link
Member

@jedevc jedevc commented Sep 26, 2022

Mentioned by @ciaranmcnulty on the community slack.

Previously, there was no simple way to create an empty named context, requiring external steps such as creating an empty directory. This change allows a single one-line context to represent the empty state.

Example usage:

docker buildx build . --build-context alpine=docker-image://scratch

Previously, there was no simple way to create an empty named context,
requiring external steps such as creating an empty directory. This
change allows a single one-line context to represent the empty state.

This patch checks for docker-image://scratch, skipping image resolution
and immediately returning the llb.Scratch state.

Signed-off-by: Justin Chadwell <me@jedevc.com>
@ciaranmcnulty
Copy link

Is it actually a docker-image? Maybe it should be the raw keyword scratch instead

@tonistiigi
Copy link
Member

Is it actually a docker-image? Maybe it should be the raw keyword scratch instead

I think this is fine as the name is reserved in hub as well. It is strange though that there is no actual image pushed.

--build-context alpine=docker-image://tonistiigi/test:nolayers works correctly for this case without any code changes.

@tonistiigi tonistiigi merged commit c46a5a5 into moby:master Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants