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
{{ message }}
Repository navigation
[Request]: Named volume pre-population from container image #729
When you mount an empty named volume to a container directory (like -v my_volume:/data), container run should automatically copy any existing files from that directory in the image into the volume on first use.
$ echo -e "FROM alpine\nRUN mkdir /xyz && touch /xyz/hello" > Dockerfile
$ container build -t myimage .
$ container run myimage ls -al /xyz/hello
-rw-r--r-- 1 root root 0 Oct 7 00:36 /xyz/hello
$ container v create xyz
xyz
$ container run -v xyz:/xyz myimage ls -al /xyz/hello
ls: /xyz/hello: No such file or directory
Code of Conduct
I agree to follow this project's Code of Conduct
Reacted by Ross Gustafson, Paul Reichelt-Ritter, Ben King, Shinnosuke Sawada-Dazai and peterkelm
Named volumes and non-root images: ownership as well as contents
Adding a data point to this issue (and #745, closed as its duplicate): beyond pre-populating contents, the ownership of a fresh named volume is what breaks most non-root images today.
On container 1.5.0 a named volume is a freshly formatted ext4 filesystem whose root is owned by 0:0, mode 0755, and nothing from the image is copied in. An image that runs as a non-root user therefore can't write to its own data directory once a volume is mounted there.
Tested on a Mac Studio (Apple silicon, macOS 27, container 1.5.0), each with a fresh named volume at the image's data path:
Activity
jglogan commentedon Oct 7, 2025
For reference, this is the desired functionality.
https://docs.docker.com/engine/storage/volumes/#mounting-a-volume-over-existing-data
katiewasnothere commentedon Oct 13, 2025
Closing, thanks @skaegi!
jglogan commentedon Oct 31, 2025
@katiewasnothere I don't see a reason for closing this? My comment was there to provide a reference to the behavior that @skaegi called out.
Reopening this as it relates to another volume-related feature.
katiewasnothere commentedon Nov 3, 2025
Sorry about that! Closing this was an error on my part.
mungler commentedon Jan 14, 2026
Commenting to follow this one as my ticket #745 was closed in favour of this one :)
Keep the git identity on the volume, where the rest of the state lives
feat(chelly): apple/container の named volume でも起動できるようにする
melonfleet commentedon Oct 18, 2026
Named volumes and non-root images: ownership as well as contents
Adding a data point to this issue (and #745, closed as its duplicate): beyond pre-populating contents, the ownership of a fresh named volume is what breaks most non-root images today.
On
container1.5.0 a named volume is a freshly formatted ext4 filesystem whose root is owned by0:0, mode0755, and nothing from the image is copied in. An image that runs as a non-root user therefore can't write to its own data directory once a volume is mounted there.Tested on a Mac Studio (Apple silicon, macOS 27,
container1.5.0), each with a fresh named volume at the image's data path:docker.io/grafana/grafana:13.2.3/var/lib/grafanamkdir: can't create directory '/var/lib/grafana/plugins': Permission denieddocker.io/prom/prometheus:v3.15.0/prometheusopen /prometheus/queries.active: permission denieddocker.io/grafana/loki:3.7.8/lokimkdir /loki/rules: permission denieddocker.io/dpage/pgadmin4:9.18.0/var/lib/pgadmin/var/lib/pgadminquay.io/jupyter/datascience-notebook:2026-10-12/home/jovyan/work/home/jovyan/workReproduction:
container volume create grafana-data container run --rm -v grafana-data:/var/lib/grafana docker.io/grafana/grafana:13.2.3 # mkdir: can't create directory '/var/lib/grafana/plugins': Permission deniedWorkaround (confirmed — Grafana then starts and
/api/healthreturns 200): chown only the mount root, once, from a root helper:It works, but every tool has to know each image's UID:GID and run an extra VM before the real one.
Docker avoids this by copying the image directory — contents and ownership — into an empty volume on first mount (docs).
Two things that would help, either on its own:
container volume create --uid 472 --gid 0 grafana-data(or--opt uid=,gid=on the local driver).mungler commentedon Oct 18, 2026
@melonfleet excellent summary 🫡