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 Answer 1

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 ?

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .