Is there a way to run a docker container as sudo, if it was build on a non sudo base-image?
with docker run
you can pass the user flag.
-u, --user string Username or UID (format: <name|uid>[:<group|gid>])
I believe the UID of root should be 0, so I think any of -u root
-u 0
-u root:root
should work?
If you're building a Dockerfile you can also add USER root
to your dockerfile to switch users.