问题是docker需要以root用户身份运行,因此maven命令需要以root用户身份运行,因此jenkins / tomcat需要以root用户身份运行,这不是一个好习惯(尽管我的非root用户是也是sudoer,所以我想不会太重要).
The problem is that docker needs to be run as root user, so maven commands need to be run as root user,
--user) parameter运行docker run,以便在容器内使用非root用户.
Either run docker as non-root user
Your user (on the host) needs to be part of the
- If there’s a known uid that the process inside the container is executing as, it could be as simple as restricting access to the host system so that the uid from the container has limited access.
- The better solution is to start containers with a known uid using the
--user(you can use a username also, but remember that it’s just a friendlier way of providing a uid from the host’s username system), and then limiting access to the uid on the host that you’ve decided the container will run as.
- Because of how uids and usernames (and gids and group names) map from a container to the host, specifying the user that a containerized process runs as can make the process appear to be owned by different users inside vs outside the container.