Skip to content

volume: Fix file subpath mount over existing image file#52584

Merged
thaJeztah merged 1 commit into
moby:masterfrom
vvoland:fix-subpath-file
May 11, 2026
Merged

volume: Fix file subpath mount over existing image file#52584
thaJeztah merged 1 commit into
moby:masterfrom
vvoland:fix-subpath-file

Conversation

@vvoland
Copy link
Copy Markdown
Contributor

@vvoland vvoland commented May 8, 2026

When a volume subpath pointing to a single file was mounted onto a target path that already existed as a file in the container image, the container creation failed with "open /var/lib/docker/tmp/safe-mountXXX: not a directory".

Skip the volume population step when the volume mount path is a file, since directory content copying is not applicable to single-file mounts.

- What I did

- How I did it

- How to verify it

- Human readable description for the release notes

Fix volume subpath file mounts over an existing file in the image failing container creation with "not a directory".

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

@vvoland vvoland self-assigned this May 8, 2026
@vvoland vvoland added this to the 29.5.0 milestone May 8, 2026
@vvoland vvoland marked this pull request as ready for review May 8, 2026 18:18
@vvoland vvoland added impact/changelog kind/bugfix PR's that fix bugs labels May 8, 2026
Comment thread integration/volume/mount_test.go Outdated
When a volume subpath pointing to a single file was mounted onto a
target path that already existed as a file in the container image, the
container creation failed with "open /var/lib/docker/tmp/safe-mountXXX:
not a directory".

Skip the volume population step when the volume mount path is a file,
since directory content copying is not applicable to single-file mounts.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
@vvoland vvoland force-pushed the fix-subpath-file branch from 0fda220 to d3adafd Compare May 11, 2026 12:00
Copy link
Copy Markdown
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit 6bfe82c into moby:master May 11, 2026
287 of 289 checks passed
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.

Mount subpath fails if the the target file path exists in the image

3 participants