In a machine that runs a docker container I attach to the running container: docker exec -it SHA1 /bin/bash
How can I see the environment variables of the process running in the container?
I see that if I try to cat /proc/$pid/environ I get a permission error despite the fact that I am root.
Why do I get the permission error? Is there another way to check the environment variables?
Asked
Active
Viewed 3,053 times
2
Jeff Schaller
- 67,283
- 35
- 116
- 255
Jim
- 1,391
1 Answers
2
An alternative to cat /proc/$pid/environ is using ps e -p $pid
see https://unix.stackexchange.com/a/29132/193945
As for the permission-error, without a Dockerfileit can be hard to tell. Are you using SELinux ? How did you start the container ?
Have you tried exec with --privileged ?
invad0r
- 230
SELinux. And no I have not started with--priviled. How does that help? – Jim Dec 29 '17 at 13:54Dockerfileand how the container is built and run ? – invad0r Jan 02 '18 at 12:26