What is the most reliable way to get the Podman container id from inside itself?
In Docker I solved it like this: basename $(cat /proc/1/cpuset)
. Unfortunately, this doesn't work for Podman, as it returns /
.
I already tried cat /etc/hostname
in Podman, however this doesn't work if the container is started with podman run --network host
.
You should be able to get it by peeking /proc/self/cgroup