I was interested in this, too, and the simplest way of approaching it seems to work now:
$ cat cli-config.json
{
"containers": [
{"name": "c1",
"image": "debian:bookworm",
"cmd": ["sleep", "inf"]},
{"name": "c2",
"image": "debian:bookworm",
"cmd": ["sleep", "inf"]}
]
}
$ fly vol create --region ewr --size 1 crimson
$ fly m run --machine-config cli-config.json \
--volume crimson:/eleven debian:bookworm
$ fly ssh console --container c1
# echo 'delight petrichor' > /eleven/password
# exit
$ fly m restart
$ fly ssh console --container c2 # works equally well with `c1`.
# cat /eleven/password
delight petrichor
# df -h /eleven
Filesystem Size Used Avail Use% Mounted on
/dev/vdd 986M 28K 919M 1% /eleven
# df -h /
Filesystem Size Used Avail Use% Mounted on
none 7.8G 188K 7.4G 1% /
As @lillian mentioned, both containers have access to the persistent volume.
(I had asked about/for that back when multi-container Machines were first announced.)
Although more streamlined, this doesn’t seem hugely different from your final attempt (or from @lillian’s earlier example), however…
Possibly something has changed in the plumbing in the intervening month; it might be worth retrying with your own preferred Machine-creation style at this point,
…