DOCKER
Volumes and mounts
A container’s own files go when the container is removed. To keep data, or to work on files from your Mac inside a container, you mount something into it. Kiri supports Docker’s three kinds of mount: volumes, bind mounts and tmpfs.
Bind mount or volume?
A bind mount puts a folder from your Mac inside the container. Kiri shares the Mac’s filesystem with its VM over virtiofs, so the container sees your files as they are, and what it writes lands straight in your folder. Use it for source code you edit on the Mac.
A volume is a folder that Kiri manages on the VM’s own disk. Your Mac’s files aren’t involved, so it suits data a container owns, such as a database.
Bind mounts
Give -v an absolute path on your Mac:
docker run -d -p 8080:80 -v ~/code/site:/usr/share/nginx/html:ro nginx
Add :ro to make the mount read-only in the container. If the Mac folder doesn’t exist, -v creates it, as Docker does; --mount type=bind reports an error instead.
docker run --rm --mount type=bind,source="$HOME/code/app",target=/app,readonly alpine ls /app
To use your Mac’s SSH agent inside a container, mount /run/host-services/ssh-auth.sock. See SSH agent.
Volumes
-v pgdata:/var/lib/postgresql/data mounts the named volume pgdata, and creates it if it doesn’t exist. The first time an empty volume is mounted, Kiri copies in what the image has at that path, as Docker does. Add :nocopy (or volume-nocopy with --mount) to skip that.
An anonymous volume has a generated name. You get one with -v /path and no source, and for each VOLUME line in the image that nothing else is mounted over. docker run --rm and docker rm -v remove a container’s anonymous volumes with it; named volumes stay until you remove them.
| Command | Notes |
|---|---|
docker volume create |
--label. Only the local driver. |
docker volume ls |
--filter on name, label, dangling and driver. |
docker volume inspect |
|
docker volume rm |
Refuses a volume a container uses, unless you add -f. |
docker volume prune |
Anonymous volumes no container uses. -a takes unused named ones too. |
Volumes also show in Kiri’s window under Volumes, where you can remove them.
Volumes
tmpfs
--tmpfs /run mounts a memory-backed filesystem that’s gone when the container stops. Options go after a colon: --tmpfs /cache:size=64m,mode=1777. With --mount, use type=tmpfs,target=/cache,tmpfs-size=67108864.
Where volume data lives
A volume is the folder /var/lib/kiri/volumes/<name>/_data on the VM’s ext4 data disk, which is what docker volume inspect shows as its mountpoint. On the Mac, that disk is one file, ~/Library/Application Support/Kiri/vm/data.img. It’s sparse: it takes up only the space that has been written to it, up to 64 GiB.
Not supported
- Volume drivers other than
local. - Mount types other than
bind,volumeandtmpfs.
© 2026 Kiri · runkiri.com