This repository was archived by the owner on Aug 29, 2022. It is now read-only.
avoid error user/group already exists #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! First of all thanks a lot for your work!
Working with this image I found an error, when you use the env variables: UNISON_USER, UNISON_GROUP, UNISON_GID, UNISON_UID. The container fails when you run docker-compose up after the first time.
The problem is that the user/group are created inside a script, that is executed every time you turn on the container. So if the user/group already exists (they are created the first time you build the container) it will fail: addgroup: group 'NAME' in use, and the same for the user.
So you've the option of always use --build when turning on the container.
The ideal solution should be delete the user/group and create them again, because you could've only changed the GID/UID. But as you're using alpine groupdel/userdel are not available and I don't want to install anything in your image!
So in resume, I've just added a check that will only create the user/group when they doesn't exists.
Regards!
(If you want to reproduce it, just set the env variables and run docker-compose up SERVICE_NAME twice, the second time it should fail)