Curious - where does systemd-nspawn store container /tmp files on the host?

Does anyone know where systemd-nspawn containers store their /tmp files on the host by default? I cannot find contents of ls /tmp from within a container in the contents of ls /tmp on the host.

My guess is that systemd uses PrivateTmp= as described here Using /tmp/ and /var/tmp/ Safely
You can use systemctl to look at details of the spawned unit to investigate.

/tmp is a tmpfs instance, similarly to what happens on the host, so it’s not visible anywhere on the host.
/var/tmp OTOH is up the the container, usually it’s just a subdirectory of /var, so it can be found somewhere under /var/lib/machines/ (the default place for container filesystems).

I’m not finding it still.

So it’s in RAM?

When I enter the container folder from the host side, I do see tmp there but it is empty (it isn’t empty on the guest side).

I’m not finding it still.

It’s not using PrivateTmp.

So it’s in RAM?

Possibly. tmpfs is swapped, so it could be in RAM and it could be in one of the swap areas.

When I enter the container folder from the host side, I do see tmp there but it is empty (it isn’t empty on the guest side).

When the container is running, contents of /var/tmp should be visible on the host.
For example, I have a rawhide machine, and on the host I see:

$ ls /var/lib/machines/rawhide/var/tmp/
systemd-private-e74ab66a7f364bf195cff170e5812a52-dbus-broker.service-sJsmZy
systemd-private-e74ab66a7f364bf195cff170e5812a52-systemd-hostnamed.service-bpSjr6
systemd-private-e74ab66a7f364bf195cff170e5812a52-systemd-oomd.service-p4hM4U
systemd-private-e74ab66a7f364bf195cff170e5812a52-systemd-resolved.service-HUZNWa
systemd-private-e74ab66a7f364bf195cff170e5812a52-systemd-timedated.service-8uVA6l

That’s interesting. I have the container folder in my home folder. Showing nothing in ~/container/tmp/ on the host, and seeing a few folders in /tmp as a guest in that container. I’m launching the container with -U, maybe user namespace isolation has to do with it?

In general, I’m not having an issue because I can access the /tmp folder from the container. But a need arises once in a while to peek into the container’s folders from the host, and I didn’t expect to find a discrepancy.

It seems you are confusing /tmp and /var/tmp.