runtime
runtime copied to clipboard
Add support for passing block devices.
Block devices can be passed to the container in the following ways:
- docker run --device=/dev/sda:/dev/vda
- docker run --mount type=bind,source=/dev/sda,target=/dev/xyz
- docker run -v /dev/sda:/dev/sdc …
In the first case, the device is passed to the runtime in the config.json under the "devices" object under "linux" as documented here https://github.com/opencontainers/runtime-spec/blob/master/config-linux.md#configLinuxDevices.
We need to add support to pass block devices to the Clear Container VM and mount them at the correct location. We can start off by using virtio-block for passing devices, followed by support for other drivers.
In case 2 and 3, the volume is passed as a bind mount and appears under the "mounts" section in config.json. Our current implementation ignores anything under /dev, while handling volumes under other non-system locations passing them as 9pfs mounts. The volumes under the system locations need to be handled as well. We can start with passing such volumes with 9pfs.
PR https://github.com/containers/virtcontainers/pull/422 opened to address this issue.