![]() ![]() RUN apt-get update & apt-get install -y some-package In the context of your question, if you've already switched to some non-root user, and you need to run some administrative command, use USER to switch back to root. sudo is also hard to script, and it's very hard to usefully maintain a user password in Docker (writing a root-equivalent password in a plain-text file that can be easily retrieved isn't a security best practice). ![]() In Docker you almost never need sudo, for three reasons: it's trivial to switch users in most contexts you don't typically get interactive shells in containers (how do I get a directory listing from inside the cron daemon?) and if you can run any docker command at all you can very easily root the whole host. (How do I add a user to my PostgreSQL server with sudo privileges? How do I add a user to my Web browser?) If you ask this question about other processes, it doesn't really make sense. Generally you should think of a Docker container as a wrapper around a single process. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |