Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: relocate /home/sage/sage out to /opt or similar, so volumes can be used to persist data (~/.local, ~/.sage, and so on) #39005

Open
1 task done
draeath opened this issue Nov 20, 2024 · 0 comments

Comments

@draeath
Copy link

draeath commented Nov 20, 2024

Problem Description

The docker container is wonderful, except that it is difficult to provide data persistence. Currently, sage is installed into the sage user's home directory. This prevents an administrator from leveraging a single podman (or docker) volume to persist data that sage, jupyter, or any of the other tools may create.

As it is now, each of these potential homedir subdirectories needs to be discovered and handled separately, cluttering up both the command line invocation as well as the volumes themselves (if not using bind-style volumes), as one can't mount a volume to the homedir path while leaving it's contents intact.

Proposed Solution

In the containers, change the installation to occur under a subdirectory of /opt instead, allowing the sage user's whole home directory to remain (mostly) empty. Items such as .bashrc are likely not relevant (I have not actually checked to see if they are just copies from /etc/skel or have been customized)

This would allow the following sort of usage to be trivial:

podman volume create whatever
podman run -it -v whatever:/home/sage:rw docker.io/sagemath/sagemath:latest

One can go even further with this sort of deployment, setting up the container via a systemd quadlet such that a notebook starts when the user logs into the system.

Alternatives Considered

I have considered other methods, such as setting the XDG_* environment variables to a location that can be a volume - however, this isn't perfect as software often does not respect these variables.

One can also copy the container's homedir into a volume, and then mount that volume over it on later runs. While this does work, it requires the user to handle upgrades manually (ie the container runtime environment and the sage install will immediately fall out of sync if a new image is pulled)

Additional Information

No response

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant