Skip to contentSkip to conversation

Dockerfile problem: cannot add group

Fuego Georg Piewald 2 participants 3 messages Oct 29, 2018 – Nov 1, 2018

lore
Share & tools
lore
#0 lore raw

Hi Tim,

Because I just read that you plan a release this week, I thought I better report this problem right away.

In the Dockerfile, there's an issue with this command:

RUN groupadd -g ${gid} ${group} \
[...]

In several Linux distros the the primary group of each user is "users", with GID 100. In this case, ${gid} in the above command will be 100 (which is passed through docker-build-image.sh). However, in Debian Jessie, which is the guest OS in the container, exactly this group with GID 100 already exists. Thus the above command fails and the container won't be created.

My solution was to first check if a group with this GID already exists, and only create it if it doesn't:

RUN getent group ${gid} > /dev/null || groupadd -g ${gid} ${group}; \
[...]

You might prefer any other solution, but it should fixed anyhow, because it's a quite annoying problem to newbies.

BR, Georg

#1 lore raw
Quoted 7 lines

-----Original Message-----
From: Georg Piewald

Because I just read that you plan a release this week, I thought I better report this problem right away.

Thanks very much!!

Quoted 13 lines

In the Dockerfile, there's an issue with this command:

RUN groupadd -g ${gid} ${group} \
[...]

In several Linux distros the the primary group of each user is "users", with GID 100. In this case, ${gid} in the above command will be 100 (which is passed through docker-build-image.sh). However, in Debian Jessie, which is the guest OS in the container, exactly this group with GID 100 already exists. Thus the above command fails and the container won't be created.

Quoted 8 lines

My solution was to first check if a group with this GID already exists, and only create it if it doesn't:

RUN getent group ${gid} > /dev/null || groupadd -g ${gid} ${group}; \
   [...]

You might prefer any other solution, but it should fixed anyhow, because it's a quite annoying problem to newbies.

This looks OK to me. I'll play around with this here in my testing this week, and incorporate something in the release (probably this, but maybe something else if issues come up during testing.)

Thanks for the report and your solution!
-- Tim

#2 lore raw
In reply to Georg Piewald

I have added this fix to the master branch, with a slight refactoring.

Thanks,
-- Tim

Quoted 35 lines

-----Original Message-----
From: Georg Piewald

Hi Tim,

Because I just read that you plan a release this week, I thought I better report this problem right away.

In the Dockerfile, there's an issue with this command:

RUN groupadd -g ${gid} ${group} \
[...]

In several Linux distros the the primary group of each user is "users", with GID 100. In this case, ${gid} in the above command will be 100 (which is passed through docker-build-image.sh). However, in Debian Jessie, which is the guest OS in the container, exactly this group with GID 100 already exists. Thus the above command fails and the container won't be created.

My solution was to first check if a group with this GID already exists, and only create it if it doesn't:

RUN getent group ${gid} > /dev/null || groupadd -g ${gid} ${group}; \
   [...]

You might prefer any other solution, but it should fixed anyhow, because it's a quite annoying problem to newbies.

BR, Georg

_______________________________________________
Fuego mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/fuego