You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scenario: Adding content from a different image on DockerHub via COPY --link, and correcting the ownership with --chown=<uid>.
When building with the buildx driver docker-container, the parent directories (/var/lib) appear to also have had their ownership modified to the --chown value.
Pulling the v12 image or anything newer has /var and /var/lib with ownership of clamav / 200, when that should only apply from /var/lib/clamav as per the Dockerfile.
Additional Information
Originally we used COPY --link until realizing the UID/GID value mapping was not reliable, and that the clamav user and group could not be used with --chown with --link, so we created the user explicitly before installing a package that would create a clamav user/group, and reference that stable UID for --chown: #2987 (comment)
UPDATE: It was assumed this was only reproducing when pulling the image from DockerHub and not local builds. It can be reproduced in local builds via the buildx driver docker-container, so is possibly a buildx specific issue (unless the --load import is akin to docker pull for images using --link?)
docker version
Client: Docker Engine - Community
Version: 24.0.1
API version: 1.43
Go version: go1.20.4
Git commit: 6802122
Built: Fri May 19 18:06:18 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 24.0.1
API version: 1.43 (minimum version 1.12)
Go version: go1.20.4
Git commit: 463850e
Built: Fri May 19 18:06:18 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.21
GitCommit: 3dce8eb055cbb6872793272b4f20ed16117344f8
runc:
Version: 1.1.7
GitCommit: v1.1.7-0-g860f061
docker-init:
Version: 0.19.0
GitCommit: de40ad0
polarathene
changed the title
COPY --link --chown changes parent dir ownership at --link pull?COPY --link --chown unexpectedly changes parent dir ownership
May 29, 2023
For anyone that is subscribed here, I looked into this recently (the bug is still reproducible):
--link usage modifies both permissions and ownership of the destination path parent dirs for any that already exist. I did not notice this originally as the defaults for /var/lib were already 755 0:0. --chown additionally replaces the default 0 / root fallback.
Description
Scenario: Adding content from a different image on DockerHub via
COPY --link
, and correcting the ownership with--chown=<uid>
.When building with the
buildx
driverdocker-container
, the parent directories (/var/lib
) appear to also have had their ownership modified to the--chown
value.Reproduction
We do have these current releases where you can observe this by pulling from the registry:
mailserver/docker-mailserver:11.3.1
:Dockerfile
COPY --link
linemailserver/docker-mailserver:12.0.0
:Dockerfile
COPY --link
line with--chown=200
addedPulling the v12 image or anything newer has
/var
and/var/lib
with ownership ofclamav
/200
, when that should only apply from/var/lib/clamav
as per theDockerfile
.Additional Information
Originally we used
COPY --link
until realizing the UID/GID value mapping was not reliable, and that theclamav
user and group could not be used with--chown
with--link
, so we created the user explicitly before installing a package that would create aclamav
user/group, and reference that stable UID for--chown
: #2987 (comment)This bug seems related to:
UPDATE: It was assumed this was only reproducing when pulling the image from DockerHub and not local builds. It can be reproduced in local builds via the
buildx
driverdocker-container
, so is possibly abuildx
specific issue (unless the--load
import is akin todocker pull
for images using--link
?)docker version
docker info
docker buildx inspect
The text was updated successfully, but these errors were encountered: