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

[24.0 backport] c8d: Fix building Dockerfiles that have FROM scratch #46302

Merged

Conversation

thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Aug 23, 2023

- What I did
Fix running containers with empty Image.

- How I did it
See commits.

- How to verify it
c8d integration tests (#45232) from TestDockerCLIBuildSuite:

- DONE 250 tests, 13 skipped, 58 failures in 352.552s
+ DONE 250 tests, 13 skipped, 42 failures in 406.027s

Before

$ printf 'FROM scratch\nLABEL asdf=1' | DOCKER_BUILDKIT=0 docker build -t asdf -
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            BuildKit is currently disabled; enable it by removing the DOCKER_BUILDKIT=0
            environment-variable.

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM scratch
 --->
Step 2/2 : LABEL asdf=1
invalid reference format

After

$ printf 'FROM scratch\nLABEL asdf=1' | DOCKER_BUILDKIT=0 docker build -t asdf -
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            BuildKit is currently disabled; enable it by removing the DOCKER_BUILDKIT=0
            environment-variable.

Sending build context to Docker daemon  2.048kB
Step 1/2 : FROM scratch
 --->
Step 2/2 : LABEL asdf=1
 ---> Running in 08bc1d65adb1
 ---> Removed intermediate container 08bc1d65adb1
 ---> 7072ecaf239f
Successfully built 7072ecaf239f
Successfully tagged asdf:latest

- Description for the changelog

containerd integration: Fix building Dockerfiles with `FROM scratch` instruction when using the legacy builder (non buildkit).

- A picture of a cute animal (not mandatory but encouraged)

If the diff is empty and don't produce an empty layer.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit eb56493)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This allows the legacy builder to apply changes to the `FROM scratch`
layer.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit dfaff95)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
If the lease doesn't exit (for example when creating the container
failed), just ignore the not found error.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit bedcc94)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added area/builder status/2-code-review kind/bugfix PR's that fix bugs area/builder/classic-builder Issues affecting the classic builder containerd-integration Issues and PRs related to containerd integration labels Aug 23, 2023
@thaJeztah thaJeztah added this to the 24.0.6 milestone Aug 23, 2023
@rumpl rumpl merged commit aade22d into moby:24.0 Aug 23, 2023
102 checks passed
@thaJeztah thaJeztah deleted the 24.0_backport_c8d-legacybuilder-fix-from-scratch branch August 23, 2023 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/builder/classic-builder Issues affecting the classic builder area/builder containerd-integration Issues and PRs related to containerd integration kind/bugfix PR's that fix bugs status/2-code-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants