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?

1

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 ?

| improve this answer | |
  • I don't even know what is SELinux. And no I have not started with --priviled. How does that help? – Jim Dec 29 '17 at 13:54
  • Can you share the Dockerfile and how the container is built and run ? – invad0r Jan 2 '18 at 12:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.