containerbase / base

The containerbase project's base image source
MIT License
35 stars 40 forks source link

Support readonly root filesystem #2078

Closed viceice closed 1 month ago

viceice commented 9 months ago

general

binarySource=global

binarySource=install

viceice commented 9 months ago

@rarkins There is one more issue! npm always tries to write to ~/.npm/_logs.

rarkins commented 9 months ago

It cannot be stopped??

viceice commented 9 months ago

not i'm aware of. i'm now redirecting home to /opt/containerbase/home, see linked PR.

We need to think about the existing data at /opt/containerbase when mounting a volume which will hide all existing. 🤔

viceice commented 8 months ago

I think we need to split installs again.

So when running as root and it's a docker build, then install tools to some other persistent path. Otherwise all files and prepare information are gone when mounting a volume to /opt/containerbase 🤔

I would add a new containerbase-cli restore command, which recreates all missing folders and files. It then symlinks the root installed files there, so the layout looks like now.

containerbase-cli restore will be called automatically by the entrypoint script and should be called by custom images with their own entrypoint.

@rarkins WDYT? Can you follow me?

rarkins commented 8 months ago

I'm not sure I fully follow, but I guess you mean that when the user mounts a volume to /opt/containerbase then anything we've put there prior is lost. So you're planning to put it in another location and symlink it over whenever the container runs?

viceice commented 8 months ago

Yes, that's the core idea.

When later running install-tool as user it will simply install to /opt/containerbase as now. I can propably also check and run the containerbase-cli restore command implicit from install-tool when something is missing inside /opt/containerbase.

rarkins commented 8 months ago

Would it be a viable alternative to allow the user to configure the containerbase rw location via env variable? If configured then the restore happens from /opt/containerbase otherwise /opt/containerbase is used? Or is it too hard to set up PATH etc?

viceice commented 8 months ago

we can't ensure path then. a user would need to explicit set it 😞