Volumes & mounts
OrbStack supports two-way file sharing between containers and macOS:
- Bind mounts, to use Mac files from containers
- Volumes for persistent storage, accessible from Mac
Bind mounts
When running containers, you can bind mount Mac files into the container. For example, to mount your Downloads folder into the container:
docker run -v $HOME/Downloads:/downloads alpine ls /downloads
docker run -v $HOME/Downloads:/downloads alpine ls /downloads
You don't need to do anything special with the paths; bind mounts work seamlessly as they would on Linux.
Faster file access
OrbStack uses the latest VirtioFS technology with additional tuning for speed, but there is still an inherent cost associated with going through macOS for file access.
For best performance, use volumes when possible. You can still use them from Mac.
Volumes
You can also create persistent volumes and attach them to containers. Data in volumes is stored directly on the Linux side, making it much faster to access from containers than bind mounts.
To create a volume, use the docker volume create
command:
docker volume create foo
docker volume create foo
To attach a volume to a container, use the -v
flag as usual, but use the volume name as the source instead of a path:
docker run -v foo:/data alpine ls /data
docker run -v foo:/data alpine ls /data
Make sure you use the volume name foo
instead of ~/OrbStack/docker/volumes/foo
.
You can access the contents of volumes from Mac through the OrbStack tab in Finder, or ~/OrbStack/docker
in the terminal. This makes it easy to debug and inspect data in volumes.
See the Docker documentation for more details.
Images
Similar to volumes, you can explore files in container images at ~/OrbStack/docker/images
.