简体   繁体   中英

Running Docker containers as non-root shows they are running as systemd+

I am trying to get Nginx and Mosquitto to run as a non-root user. I set the user option and am using the Nginx image and a Ubuntu image with Mosquitto installed in it. When I do a docker top nginx or mosquitto it gives me this output which says it is running as systemd.

admins@mmig:/folder/docker/folder$ docker top mosquitto UID PID PPID C STIME TTY TIME CMD systemd+ 1116290 1116273 0 16:31? 00:00:00 /bin/sh -c mosquitto -v -c /etc/mosquitto/mosquitto.conf systemd+ 1116404 1116290 1 16:31? 00:00:00 mosquitto -v -c /etc/mosquitto/mosquitto.conf

How can I get it to run as the user I am wanting it to run as instead which is mosquitto in this case?

When using "docker top mosquitto" I was seeing the UID of my local host /etc/passwd file and not the UID in the /etc/passwd file in the container. To fix this I will have to change the UID on the mosquitto user in the container.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM