Closed ezrizhu closed 8 months ago
As indicated earlier in #19, we are not planning on implementing this right now. This issue is just for documentation purposes.
I’ll close this as won’t fix, until maybe someday we want to address this.
For now, to use try
in docker, one can do the following to make a sandbox in a tempfs, then have try
use that sandbox.
mkdir sb
mount -t tmpfs tmpfs sb
./try -D sb <command here>
Currently try will not work in docker containers, as they’re backed by overlayfs already (by docker default).
Stackoverflow has a solution to this, which works.
Essentially, the directory that both
upperdir
andworkdir
resides in has to be tmpfs. Note that making just theupperdir
andworkdir
tmpfs is not sufficient.We can modify try to leverage this to enable support for docker.
This is trivial to do if we only care about running this try as root. We can simply run
mount -t tmpfs tmpfs “$SANDBOX_DIR”
aftermktemp -d
ing it.However, if we want to do this as a user (in docker containers), this becomes tricky, as we will have to make the tmpfs in unshare, which is also do-able, i was able to make a proof of concept to do this. However, that tmpfs will disappear after we exit the unshare, so we will have to find a way to persist it. This will require some considerable refactoring.