apple / apple/container

[Request]: Named volume pre-population from container image

Open
#729 5 comments 3 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
49.9k
Forks
1.8k
Avg merge
1d 20h
Merged PRs (30d)
22

Description

### Feature or enhancement request details

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

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start at the container run path that handles named-volume mounting and the image filesystem setup; the issue provides a Dockerfile and command sequence to reproduce the behavior. Trace how empty and existing volumes are distinguished. Done means files present at the mounted directory in the image are available on first use, while existing volume contents are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
devtools, infrastructure
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.