mozilla-services / Dockerflow

Cloud Services Dockerflow specification
Apache License 2.0
195 stars 28 forks source link

Group and user creation arguments are ambiguous #36

Closed acmiyaguchi closed 6 years ago

acmiyaguchi commented 6 years ago

https://github.com/mozilla-services/Dockerflow/blob/09475d1a803f8e8d61a68c3956a17041bc4ac515/Dockerfile#L5-L6

Depending on the underlying distribution of the container, these options can be ambiguous. The options should use the full name format for readability.

acmiyaguchi commented 6 years ago

These lines should probably use useradd and groupadd binaries instead of the bundled adduser and addgroup perl scripts for portability.

I think the following lines have the same semantics as the original. According to the man pages for useradd(8), this could possibly be shortened down to a single line using the --user-group option.

RUN groupadd --gid 10001 app && \
    useradd --gid 10001 --uid 10001 --home-dir /app app
ckolos commented 6 years ago

I don't believe this is intended to be a canonical Dockerfile that fits all use cases. For example, the alpine container used in the example doesn't even contain the groupadd or useradd commands.

acmiyaguchi commented 6 years ago

I see, the alpine container uses busybox instead of the standard unix tools.

It may not be a one-size-fits-all container, but its an accessible reference. It was useful regardless for setting up the user and group in my own Dockerfile.