apple / apple/container

[Request]: Support disk images for volumes

Open
#1,228 7 comments 3 reactions 1 assignee Claimed by @dcantah View on GitHub
storage
Dominant language
Swift
Stars
49.9k
Forks
1.8k
Avg merge
1d 20h
Merged PRs (30d)
22

Description

### Feature or enhancement request details

Maybe this exists, but if it does I could not figure out how to do it 😀.

I have a disk image file that I want to mount directly in the container. In this case, the disk image is an ASIF image.

I tried something like:

```
containers run --volume /my/cool/image/asif.img:/mounted_image
```

But that errors out saying the sharing device is not a directory.

Ideally this would handle a password protected image as well by asking for each image's password over the TTY (like `diskutil image attach` does).

I _think_ some support for this in `containerization` already: https://github.com/apple/containerization/blob/cb3493b507a19fdc8faa8f3f5bb7490a3d422e3a/Sources/Containerization/Mount.swift#L136-L141

But I can't figure out how to use a disk image as a volume directly (or maybe I am misunderstanding what the containerization mount configuration does).

I can work around this by mounting the image myself by using `diskutil image attach -b --mountPoint etc etc` but it would be great if `container` could do this for me.

### Code of Conduct

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.