Open dimas opened 7 years ago
This bit me too, I had to resort to either doing a tmpdir on the host, or manually creating a pseudo-tmpdir in the container which I then clean up afterwards. It had me really confused for a while before I figured out what was going on.
Right now /tmp
in the container is an actual tmpfs created by systemd-nspawn. I think in the not too distant future I'm going to write a runc engine and make that the default, which should hopefully change this behavior.
Maybe I do not get what you're doing, but it seems proper to me to not include /tmp/
in images. I don't understand what @dgonyeo means where he wrote ‘that the default’ and ‘this behavior’. /tmp
being a tmpfs is the current and right situation, not?
@sanmai-NL /tmp
being a tmpfs is only true if a tmpfs is mounted at /tmp
. The systemd-nspawn
engine (the default) does mount a tmpfs there (or at least deletes the files afterwards, I haven't checked). The chroot
engine (which can be enabled with a flag) does not mount a tmpfs there. Thus if users are expecting to be able to put files in /tmp
and have them be available inside a run
command, the chroot
engine must be used.
When I write a runc
engine (and I intend for it to be the default eventually) I wasn't planning on mounting a tmpfs unless runc does this already.
@dgonyeo: Just encountered this issue, again. Seems like it is still very confusing! Where would be the appropriate place to document this?
This should probably be mentioned under the systemd-nspawn
section of https://github.com/containers/build/blob/master/Documentation/subcommands/run.md
Neither "acbuild copy" nor commands started with "acbuild run" cannot make any changes on /tmp
To be honest I do not know much on how containers work so maybe that whole tempfs thing lives only for the duration of the command in which case it is an expected behaviour. This theory is supported by
But maybe it makes sense to put this in docs / FAQ too then? Because /tmp is a typical choice of downloading something before installing it so can save people some time (I searched first - https://github.com/containers/build/search?utf8=%E2%9C%93&q=tmp)