5

There is almost no disk space left in my home directory but I have a lot of disk space in the directory /scratch/tmpexperiment. That directory is now empty.

I would like to try out the commands podman and buildah (just to experiment and learn). After the experiment I would like to erase the directory /scratch/tmpexperiment.

Is it possible to instruct podman and buildah to only create and write files under /scratch/tmpexperiment?

Preferably my home directory should remain untouched during the experiment (or at least modified as little as possible).

My user does not have sudo permissions. This question is regarding non-root (rootless) use of podman and buildah. The installed software versions are podman 1.4.0 and 1.9.0-dev.

Erik Sjölund
  • 10,690
  • 7
  • 46
  • 74

2 Answers2

2

Two ways to do this. One would be to bind mount a directory fro /stratch/tmpexperiment on ~/.local/share/containers.

Second would be to run

podman info, then edit ~/.config/containers/storage.conf

And modify graphroot option

graphroot = "/home/dwalsh/.local/share/containers/storage"

To something like

graphroot = /stratch/tmpexperiment/containers/storage

rhatdan
  • 392
  • 1
  • 1
  • On Ubuntu 19.04: `mount -o bind /stratch/tmpexperiment ~/.local/share/containers` fails with _mount: only root can use "--options" option_ . My user does not have sudo permissions. But it looks like the second way will work. – Erik Sjölund Jun 16 '19 at 12:42
0

In addition to the possibilities outlined by @rhatdan, the Podman documentation offers up another option:

In Rootless mode images are pulled under XDG_DATA_HOME when specified, otherwise in the home directory of the user under $HOME/.local/share/containers/storage.

So in your case e.g.

env XDG_DATA_HOME=/stratch/tmpexperiment/containers/storage podman run <container>

should work.

See also this answer.

user35915
  • 1,222
  • 3
  • 17
  • 23