Add volume variant for persistent /home/user mount#316
Open
Add volume variant for persistent /home/user mount#316
Conversation
Introduces ZWIFT_VARIANT=minimal mode where /home/user is mounted as a persistent volume. Zwift installs on first run into the volume instead of being baked into the container image. Eliminates per-launch chown for Docker users with non-1000 uid/gid and reduces image size.
Instead of a separate lightweight image that installs Zwift at first run, use the same pre-installed image with a /home/user volume mount. Docker and Podman auto-populate new named volumes from image contents, so the first launch is instant with no installation step needed.
197cee9 to
a7f49c5
Compare
Before launching Zwift, compare the image version (OCI label) against a marker in the volume. If they differ, run an init container that rsyncs the image /home/user into the volume, preserving user data (activities, workouts, logs, prefs, screenshots). This keeps the volume up to date with the image without network downloads or image size duplication.
Owner
Author
|
This might be the way going forward, however very unsure, as it might have unforseen implications. It would allow us to run zwift in a volume, as opposed to within a container, and by default everything is persisted, as opposed to being ephemeral. Update is somewhat trickier, but i guess we can test this approach to see how it fares over time, and if this seems to work, it might be favorable to todays solution and we might remove the ZWIFT_VARIANT=container option. What are your thoughts @glennvl? |
glennvl
reviewed
Mar 12, 2026
Contributor
glennvl
left a comment
There was a problem hiding this comment.
I have a few thoughts about this, but let's discuss those in the issue instead.
Co-authored-by: Glenn <glenn.vanloon@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ZWIFT_VARIANT=volumemode where/home/useris mounted as a persistent Docker volume (zwift-home-$USER)chownfor Docker users with uid/gid != 1000zwift-volumeNix package andvariantoption to NixOS moduleHow it works
Docker and Podman automatically copy image contents into a new named volume on first mount. By mounting
/home/useras a volume instead of just the Zwift docs directory, the entire wine prefix persists between runs.Volume sync on image update: Before launching,
zwift.shcompares the image's OCI version label against a marker file in the volume. If they differ, it runs a short-lived container that mounts the volume at/mnt/volume(keeping the image's/home/uservisible) and usesrsyncto copy updated files into the volume. User data (activities, workouts, logs, preferences, screenshots) is excluded from the sync.Files changed
src/zwift.shsrc/entrypoint.shZWIFT_VOLUME=1src/update_zwift.shrm -rf $ZWIFT_DOCSbehindZWIFT_VOLUMEchecksrc/Dockerfilersyncpackage.github/workflows/zwift_build_from_scratch.yamlZWIFT_IMAGE_VERSIONenv var at commit timeflake.nixvariantoption,zwift-volumepackagedocs/advanced/volume-variant.mddocs/configuration/options.mdZWIFT_VARIANTto options tabledocs/advanced/nixos.mdvariantto NixOS config exampledocs/troubleshooting/slow-start.mdTest plan
container) still works unchangedLocal testing instructions (no Zwift installation required)
Closes part of issue 28 (variant 2: volume-based). Remaining work on issue 28: variants 3-4 (native wine).