Docker Community Forums

Share and learn in the Docker community.

Access host /proc

(Peepe) #1


I would like to expose a server monitoring app as a docker container. The app i have written relies on /proc to read system information like CPU utilization or disk stats. Thus i have to forward the information provided in hosts /proc virtual file system to my docker container.

So i made a simple image (using the first or second intro on docker website: Link) and started it:
docker run -v=/proc:/host/proc:ro -d hostfiletest
Assuming the running container could read from /host/proc to obtain information about the host system.

I fired up a console inside the container to check:
docker exec -it {one of the funny names the container get} bash
And checked the content of /host/proc.

Easiest way to check it was getting the content of /host/proc/sys/kernel/hostname - that should yield the hostname of the vm iam working on.
But i get the hostname of the container, while /host/proc/uptime gets me the correct uptime of the vm.

Do i miss something here? Maybe something conceptual?

Docker version 17.05.0-ce, build 89658be running on Linux 4.4.0-97-generic (VM)


UPDATE 31.10:

  • Fixed typo