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

Add '-o' to groupadd and useradd to fix error #12

Closed
wants to merge 1 commit into from

Conversation

hachi8833
Copy link

  • macOS: 14.4.1 Sonoma
  • Docker Desktop for Mac: 4.28.0 (139021)
  • cargo 1.74.1 (ecb9851af 2023-10-18)

As far as I checked this tool by runningcargo clean;cargo build;cargo install --path . and then path/to/rails-new app_name --main, the following error occurs:

 => ERROR [2/3] RUN groupadd -g 20 app && useradd -u 501 -g app -m app                      0.1s
------
 > [2/3] RUN groupadd -g 20 app && useradd -u 501 -g app -m app:
0.132 groupadd: GID '20' already exists
------
Dockerfile:5
--------------------
   3 |     ARG USER_ID=1000
   4 |     ARG GROUP_ID=1000
   5 | >>> RUN groupadd -g $GROUP_ID app && useradd -u $USER_ID -g app -m app
   6 |     USER app
   7 |     ARG RAILS_VERSION
--------------------
ERROR: failed to solve: process "/bin/sh -c groupadd -g $GROUP_ID app && useradd -u $USER_ID -g app -m app" did not complete successfully: exit code: 4

View build details: docker-desktop://dashboard/build/desktop-linux/desktop-linux/ise7q36c2kuyza1pnuw26km5y
thread 'main' panicked at src/main.rs:41:5:
assertion failed: status.success()
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I added -o options to groupadd and useradd to fix the error.

@rafaelfranca
Copy link
Member

Thank you for the pull request. I don't think we should override a group id or user id already existent in the system.

In the case of MacOS, it is probably a better option to not create a new group.

@hachi8833 hachi8833 deleted the fix_dockerfile branch April 12, 2024 02:02
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

Successfully merging this pull request may close these issues.

2 participants