Docker: jenkins:alpine into the container,Unable to obtain root permissions.

Created on 15 Mar 2018  ·  7Comments  ·  Source: jenkinsci/docker

bash-4.3$ su
su: must be suid to work properly

bash-4.3$ sudo apk add wget
bash: sudo: command not found

Most helpful comment

Use this to get inside the container: docker exec -it --user root $(containerName) /bin/bash

All 7 comments

It is expected behavior as it is best practice to run processes that dont require root as a user. To install packages to your docker container build your own image.
Btw. The image got curl if you dont want to build your own image.

When there is a new update
New version of Jenkins (2.89.4) is available for download (changelog).
I download the new war package and can't update it to the directory.

Update your docker by pulling the version you like to update to from here and redeploy the jenkins container with the pulled image.

Use this to get inside the container: docker exec -it --user root $(containerName) /bin/bash

使用它来进入容器: docker exec -it --user root $(containerName) /bin/bash

Thank you

It is expected behavior as it is best practice to run processes that dont require root as a user.

@Nols1000 The processes are run inside a container. What's the harm in that? Not being able to su hinders debugging.

For anyone with the same question as @x-yuri here are the first 3 results from Google that explain in good detail what the harm is in running as root users in containers.

https://engineering.bitnami.com/articles/why-non-root-containers-are-important-for-security.html
https://medium.com/@mccode/processes-in-containers-should-not-run-as-root-2feae3f0df3b
https://americanexpress.io/do-not-run-dockerized-applications-as-root/

Keep your containers safe y'all, and happy coding!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ThStock picture ThStock  ·  8Comments

ozbillwang picture ozbillwang  ·  3Comments

arthurvanduynhoven picture arthurvanduynhoven  ·  3Comments

simonCor picture simonCor  ·  3Comments

mattesja picture mattesja  ·  5Comments