Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adduser in Dockerfile recommendation. #18

Open
osunderdog opened this issue Apr 16, 2017 · 0 comments
Open

adduser in Dockerfile recommendation. #18

osunderdog opened this issue Apr 16, 2017 · 0 comments

Comments

@osunderdog
Copy link

First off... Thank you for building the Dockerfile for mosquitto!

The debian package mosquitto creates the user mosquitto.
During docker-mosquitto build the following line is printed (at least for me):

The system user `mosquitto' already exists. Exiting.
 ---> 76775d4bf147

I comment out the adduser line in the Dockerfile and built a container and tested:

brucelowther@DeepThought:~/src/Docker/docker-mosquitto$ docker run -ti -u mosquitto mosquitto:woadduser id
uid=104(mosquitto) gid=107(mosquitto) groups=107(mosquitto)

Indicates that the user is created even though the adduser line is commented out.

Confirmed this by looking at the debian package build:
mosquitto.postinst

From the postinst step, it will use the existing mosquitto uid rather than creating a uid.

Recommend flipping the two steps in the Dockerfile.

  • Create the mosquitto user
  • Install mosquitto package.

The reason this is important to me is that I want to match up the UID on the docker server (121) with the UID created in the container.

May be short sighted, but it works for me right now.

    adduser --uid 121 --system --disabled-password --disabled-login mosquitto  && \
    apt-get update && apt-get install -y mosquitto mosquitto-clients

Then I get UID that matches the target system.

brucelowther@DeepThought:~/src/Docker/docker-mosquitto$ docker run -ti -u mosquitto mosquitto:flipadduser id
uid=121(mosquitto) gid=65534(nogroup) groups=65534(nogroup)

I'm a novice.. hope this is clearly described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant