Skip to content

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

Merged
rumpl merged 3 commits intomoby:24.0from
thaJeztah:24.0_backport_c8d-legacybuilder-fix-from-scratch
Aug 23, 2023
Merged

[24.0 backport] c8d: Fix building Dockerfiles that have FROM scratch#46302
rumpl merged 3 commits intomoby:24.0from
thaJeztah:24.0_backport_c8d-legacybuilder-fix-from-scratch

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 Build status/2-code-review kind/bugfix PR's that fix bugs area/builder/classic-builder Build 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
@thaJeztah thaJeztah requested review from rumpl and vvoland August 23, 2023 18:24
@rumpl rumpl merged commit aade22d into moby:24.0 Aug 23, 2023
@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 Build area/builder Build containerd-integration Issues and PRs related to containerd integration kind/bugfix PR's that fix bugs status/2-code-review

Projects

Development

Successfully merging this pull request may close these issues.

4 participants