Skip to content

COPY --chown does not work right #187

@sosiouxme

Description

@sosiouxme

https://bugzilla.redhat.com/show_bug.cgi?id=1937087

$ cat > Dockerfile << EOF
FROM registry.access.redhat.com/ubi8:latest
COPY --chown=1001:0 myfile /myfile
RUN ls -l /myfile
EOF

$ touch myfile

$ imagebuilder --tag yolo:latest .
--> FROM registry.access.redhat.com/ubi8:latest as 0
--> COPY --chown=1001:0 myfile /myfile
--> RUN ls -l /myfile
-rw-rw-r--. 1 root root 0 Mar  9 19:01 /myfile
--> Committing changes to yolo:latest ...
--> Done

# ^ Notice how the file is owned by root when using imagebuilder
# v Notice how the file has the expected ownership when using podman

$ podman build --no-cache -t yolo:latest .
STEP 1: FROM registry.access.redhat.com/ubi8:latest
STEP 2: COPY --chown=1001:0 myfile /myfile
--> ea573ccd64f
STEP 3: RUN ls -l /myfile
-rw-rw-r--. 1 1001 root 0 Mar  9 19:01 /myfile
STEP 4: COMMIT yolo:latest
--> 4a1c709a0c0
4a1c709a0c04b310cdbf45fd8791a534e2c54c320634da2c5c153b74b87fa67b

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions