# Access host /proc

**URL:** <https://forums.docker.com/t/access-host-proc/40604>\
**Category:** General\
**Created:** [October 31, 2017, 2:40pm UTC](https://forums.docker.com/t/access-host-proc/40604 "2017-10-31T14:40:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![peepe](https://avatars.discourse-cdn.com/v4/letter/p/df705f/32.png) [@peepe](https://forums.docker.com/u/peepe)\
**Post date:** [October 31, 2017, 2:40pm UTC](https://forums.docker.com/t/access-host-proc/40604/1 "2017-10-31T14:40:06Z")

</div>

Hi,

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](https://docs.docker.com/get-started/part2/#the-app-itself)) 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)

Greetings  
Peepe

UPDATE 31.10:

- Fixed typo

---

<div class="post-metadata">

**Author:** ![nadavleva](https://avatars.discourse-cdn.com/v4/letter/n/e19b73/32.png) [@nadavleva](https://forums.docker.com/u/nadavleva)\
**Post date:** [March 21, 2021, 4:55pm UTC](https://forums.docker.com/t/access-host-proc/40604/2 "2021-03-21T16:55:01Z")

</div>

Hello  
I’m having a similar issue,  
Did you succeed in reading process information from the host, not the docker?  
I read some reference that running as privileged container is not enough and some more setting in the container execution are required like refrencing host process and host proc, e.g ```  
-h `hostname`   
-v /var/run/docker.sock:/var/run/docker.sock -v /proc/:/host/proc/:ro   
-v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro

```auto
Thanks
Nadav
```

---

<div class="post-metadata">

**Author:** ![derteufelqwe](https://sea3.discourse-cdn.com/docker/user_avatar/forums.docker.com/derteufelqwe/32/29588_2.png) [@derteufelqwe](https://forums.docker.com/u/derteufelqwe)\
**Post date:** [March 22, 2021, 2:00pm UTC](https://forums.docker.com/t/access-host-proc/40604/3 "2021-03-22T14:00:09Z")

</div>

Linux files are kinda tricky. Just because it looks like a file, doesn’t mean thats actaully a real file.  
I think thats the problem here. [This Stackoverflow answer](https://unix.stackexchange.com/questions/164089/where-does-hostname-store-the-hostname-that-ive-set) says that the hostname is entirely stored in kernel memory and I think the file `/proc/sys/kernel/hostname` represents the hostname stored in kernel memory. Therefore it doesn’t matter if you mount the file from the host.

Mounting `/etc/hostname` does the trick tho.
