2

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?

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Jim
  • 1,391

1 Answers1

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