Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --user root to docker exec command #389

Merged
merged 2 commits into from
Mar 31, 2017

Conversation

PaulFurtado
Copy link
Contributor

If containers were run with their user set to something other than root, docker exec will exec the command in the container as that user by default. Unfortunately, this causes many package manager commands to fail. This commit adds --user root to the docker exec command so that commands executed inside the container will always run as root.

If containers were run with their user set to something other than root,
docker exec will exec the command in the container as that user by
default. Unfortunately, this causes many package manager commands to
fail. This commit adds --user root to the docker exec command so that
commands executed inside the container will always run as root.
@PaulFurtado
Copy link
Contributor Author

(Actually just pushed another commit to run as --user 0 rather than --user root. The reason is because some containers, specifically kubernetes pause containers, don't have an /etc/passwd file, so --user root doesn't work. --user 0 should work in all cases)

@kotakanbe
Copy link
Member

Sorry for late reply.
I will check after Vuls Festival(3/24) @ TOKYO.

@knqyf263
Copy link
Contributor

LGTM👍

@knqyf263 knqyf263 merged commit d4bec0d into future-architect:master Mar 31, 2017
@knqyf263
Copy link
Contributor

Many Thanks!

@kotakanbe kotakanbe added the bug label Apr 4, 2017
@kotakanbe kotakanbe modified the milestone: v0.4.0 Apr 4, 2017
lapthorn pushed a commit to lapthorn/vuls that referenced this pull request May 11, 2017
* Add --user root to docker exec command

If containers were run with their user set to something other than root,
docker exec will exec the command in the container as that user by
default. Unfortunately, this causes many package manager commands to
fail. This commit adds --user root to the docker exec command so that
commands executed inside the container will always run as root.

* Use numerical id for root rather than name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants