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

Build fails with "Directory /host/build/rpms must exist" after upgrading to Docker 23 #2783

Closed
markusboehme opened this issue Feb 7, 2023 · 2 comments · Fixed by #2784
Closed
Assignees
Labels
area/core Issues core to the OS (variant independent) status/in-progress This issue is currently being worked on type/bug Something isn't working

Comments

@markusboehme
Copy link
Member

Platform I'm building on: Fedora 36 on x86_64

What I expected to happen: The build of individual packages and entire images to succeed after upgrading from Docker 20 to Docker 23.

What actually happened: The build failed:

[...]
   > [rpmbuild 6/7] RUN --mount=target=/host     ln -s /host/build/rpms/*.rpm ./rpmbuild/RPMS     && createrepo_c         -o ./rpmbuild/RPMS         -x '*-debuginfo-*.rpm'         -x '*-debugsource-*.rpm'         --no-database         /host/build/rpms     && cp .rpmmacros /etc/rpm/macros     && dnf -y         --disablerepo '*'         --repofrompath repo,./rpmbuild/RPMS         --enablerepo 'repo'         --nogpgcheck         builddep rpmbuild/SPECS/grub.spec:
  #17 0.213 Directory /host/build/rpms/ must exist
[...]

How to reproduce the problem:

  1. Run Docker 23
  2. cargo make clean
  3. cargo make -e BUILDSYS_VARIANT=metal-dev
@markusboehme markusboehme added type/bug Something isn't working status/needs-triage Pending triage or re-evaluation labels Feb 7, 2023
@markusboehme markusboehme self-assigned this Feb 7, 2023
@markusboehme markusboehme added status/research This issue is being researched and removed status/needs-triage Pending triage or re-evaluation labels Feb 7, 2023
@markusboehme
Copy link
Member Author

I played around with this a bit and found a change in the handling of .dockerignore files between Docker 20 and Docker 23 must be causing this error. The following setup can serve as a small reproducer:

mkdir dockerignore-test && cd $_
mkdir -p dir/subdir
cat >.dockerignore <<EOF
/dir/*
!/dir/subdir/*
EOF
cat >Dockerfile <<EOF
FROM alpine:latest
RUN --mount=target=/context test -d /context/dir/subdir
EOF

Building with DOCKER_BUILDKIT=1 docker build . succeeds on Docker 20, but fails on Docker 23. Docker 23 will only include the subdir if it's not empty. Docker 20 will include it regardless.

There is a similar situation with the build/rpms directory in Bottlerocket's .dockerignore file when starting with a clean working directory. I'll prepare a PR.

@markusboehme markusboehme added status/in-progress This issue is currently being worked on area/core Issues core to the OS (variant independent) and removed status/research This issue is being researched labels Feb 7, 2023
@markusboehme
Copy link
Member Author

Not opening a GitHub issue in the Moby repo for this. The new behavior seems reasonable to me. From looking around, changes in how .dockerignore is interpreted also don't seem all that uncommon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Issues core to the OS (variant independent) status/in-progress This issue is currently being worked on type/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant