azurelinux icon indicating copy to clipboard operation
azurelinux copied to clipboard

Docker build fails to mount a single file

Open RocketJas opened this issue 1 year ago • 3 comments

There is an issue with the version of docker on the latest AzureLinux container image

Docker build failing to mount single file via bind When running docker build (with DOCKER_BUILDKIT=1) on the mariner image, the RUN stage fails when attempting to mount a single file --mount=type=bind with the error

executor failed running [/bin/bash -euxc bash tmp/test_mount.sh]: failed to mount /var/lib/docker/tmp/buildkit-mount3000888503: [{Type:bind Source:/proc/self/fd/25 Options:[rbind ro]}]: not a directory

To Reproduce Steps to reproduce the behavior:

  1. Ensure you are running on a mariner OS
  2. Clone repo
  3. Set the Environment Variable export DOCKER_BUILDKIT=1
  4. From the root directory run docker build -t test_dockerfile_mariner -f test.dockerfile .

RocketJas avatar Feb 27 '24 15:02 RocketJas

I hit this too. With the help of dnf history I managed to inspect my recent upgrades.

  • sudo dnf downgrade moby-cli-20.10.27-3.cm2.x86_64 didn't seem to help.
  • sudo dnf downgrade moby-cli-20.10.27-2.cm2.x86_64 still didn't fix it.
  • sudo dnf downgrade moby-engine-20.10.27-1.cm2.x86_64 worked, I think I had to restart docker too. Maybe the above downgrades aren't needed but I'm holding off upgrading again until this is fixed.

mattsheerin avatar Mar 01 '24 10:03 mattsheerin

Hi @RocketJas, the link to the repo doesn't seem valid anymore. Do you still have this issue? I can confirm that some of our builds, we do have --mount=type=bind usage in Mariner and it works successfully. We do install moby-buildx package for this functionality.

mandeepsplaha avatar May 23 '24 15:05 mandeepsplaha

I recently hit a different problem and installed moby-buildx as a solution. Today I tried the problematic build for the first time in a while, this time with all the latest moby RPMs, and still have this issue.

In your builds, do you use --mount=type=bind for files or directories? I seem to only have the problem for mounting individual files, but I've not tested that extensively.

Solution for me is still:

sudo dnf downgrade moby-engine-20.10.27-1.cm2.x86_64
sudo systemctl restart docker

mattsheerin avatar Jun 17 '24 23:06 mattsheerin