buildah icon indicating copy to clipboard operation
buildah copied to clipboard

Unable to change VOLUME mount point permissions and owner after volume is declared

Open Peter-Sh opened this issue 2 years ago • 10 comments

Description

Permissions (and owner) of volume directory cannot be changed after VOLUME directive is applied in current or parent image.

This seems to be default behaviour for docker, but works with DOCKER_BUILDKIT=1 and as such may be considered a useful feature.

The use case is to change directory permissions of /data volume declared in parent image to be able to run image in restricted environment (openshift with changing uids). If volume is declared in parent image you have to fully copy parent Dockerfile in order to just change permissions (and owner) of volume mount point.

Steps to reproduce the issue:

Tested with latest stable and testing buildah.

buildah bud --no-cache -<<DOCKERFILE
FROM alpine:3.16.2
RUN mkdir /data && chmod 600 /data
VOLUME /data
RUN chgrp -R 0 /data && chmod g=rwxs -R /data
RUN ls -aldh /data
DOCKERFILE

Describe the results you received:

STEP 5/5: RUN ls -aldh /data
drw-------    2 root     root           6 Nov  8 16:16 /data

Describe the results you expected:

Results of docker build with DOCKER_BUILDKIT=1

#7 [4/4] RUN ls -aldh /data
#7 sha256:73312dd88ff870fc9d847b569c92d2bbd675bdf4b8e2acb24cca091891102028
#7 0.248 drw-rws---    1 root     root           6 Nov  8 16:17 /data

Peter-Sh avatar Nov 08 '22 16:11 Peter-Sh

I think we should follow Buildkit defaults. @flouthoc PTAL

rhatdan avatar Nov 08 '22 21:11 rhatdan

I agree we should default to buildkit's behavior I'll open a PR for this.

flouthoc avatar Nov 17 '22 10:11 flouthoc

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Dec 18 '22 00:12 github-actions[bot]

@flouthoc any progress?

rhatdan avatar Dec 18 '22 12:12 rhatdan

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jan 18 '23 00:01 github-actions[bot]

Removing stale.

flouthoc avatar Jan 18 '23 10:01 flouthoc

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Feb 18 '23 00:02 github-actions[bot]

@flouthoc Reminder

rhatdan avatar Feb 21 '23 19:02 rhatdan

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Mar 24 '23 00:03 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Apr 27 '23 00:04 github-actions[bot]