#Reading procfs with (*Container).File(string)

1 messages · Page 1 of 1 (latest)

forest raptor
#

I would like to inspect a container to find the number of available CPUs so that I can generate the right build commands. It looked like I should be able to read "/proc/cpuinfo" from the container, but this fails with an error

container.from.file lstat /tmp/buildkit-mount707493033/proc/cpuinfo: no such file or directory

I think I can work around this using Exec, but it's a bit of a surprising error to me ...

onyx moth
#

That’s because /proc is a virtual filesystem that only exists in memory for processes running inside the container where it’s mounted

#

So it’s actually expected behavior that you need an exec for this

forest raptor
#

So it's not there because .File doesn't have a mount namespace for procfs?

#

FWIW, an exec with a redirect works fine.

karmic hull