taller-test icon indicating copy to clipboard operation
taller-test copied to clipboard

groupadd: GID '0' already exists

Open lucasconstantino opened this issue 7 years ago • 5 comments

While building the project, some users are reporting the following issue:

groupadd: GID '0' already exists

Apparently, the environment variable GROUP_ID is not coming as expected.

lucasconstantino avatar Apr 25 '18 01:04 lucasconstantino

@renatorib has fixed the issue by basically removing any user/group creation. The resulting Dockerfile is as follows:

FROM taller/drupal-node
# Build-time configuration.
# -------------------------
# This is mostly useful to override on CIs.
ARG APP_NAME=drupal
ARG GROUP_ID=1000
ARG USER_ID=1000
# Configure environment.
# ----------------------
ENV APP_NAME=${APP_NAME}
ENV USER_NAME=${APP_NAME}
# ENV GROUP_ID=${GROUP_ID}
# ENV GROUP_NAME=${APP_NAME} USER_ID=${USER_ID} USER_NAME=${APP_NAME}
# Create group and user.
# ----------------------
# RUN groupadd --gid ${GROUP_ID} ${GROUP_NAME}                                                                          \
#    && echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers                                                           \
#    && useradd -u ${USER_ID} -G users,www-data,sudo -g ${GROUP_NAME} -d /${APP_NAME} --shell /bin/bash -m ${APP_NAME} \
#    && echo "secret\nsecret" | passwd ${USER_NAME}
# Nginx configs.
# -------------
COPY ./nginx.conf /etc/nginx/nginx.conf
# Import files.
# -------------
COPY ./.bashrc /${APP_NAME}/.bashrc
# RUN chown ${USER_NAME}:${GROUP_NAME} /${APP_NAME}/.bashrc
# Make site available.
# --------------------
RUN rm -Rf /var/www/drupal \
    && ln -s /${USER_NAME}/app/drupal /var/www/drupal
# Install node global dependencies.
# ---------------------------------
COPY ./.nvmrc /etc/.nvmrc
RUN . /usr/local/nvm/nvm.sh && \
    cd /etc/ && nvm install v8.9.1 && nvm alias default && nvm use default && \
    npm install -g yarn
# Setup user and initialization directory.
# ----------------------------------------
# USER ${USER_NAME}
WORKDIR /${USER_NAME}/app
# Setup PATH env variables.
# -------------------------
ENV PATH="/${USER_NAME}/app/vendor/bin:$PATH"
# Install prestissimo for faster composer installs.
# -------------------------------------------------
# RUN sudo cp -R /root/.composer /${USER_NAME}/.composer \
#    && sudo chown ${USER_NAME}:${GROUP_NAME} -R /${USER_NAME}/.composer
# Setup default App variables.
# ----------------------------
ENV GRAPHQL_HOST="http://localhost/graphql"
# Configure entrypoint.
# ---------------------
COPY ./entrypoint.sh /etc/entrypoint.sh
RUN sudo chmod +x /etc/entrypoint.sh
CMD ["/bin/bash"]
ENTRYPOINT ["/etc/entrypoint.sh"]

@sebas5384 could you have a look at that?

lucasconstantino avatar Apr 25 '18 01:04 lucasconstantino

I guess it might be related to sudo

renatorib avatar Apr 26 '18 20:04 renatorib

@renatorib it might be. But honestly, if we can simply get rid of this it would make the building simpler. We simply need to understand what issues does it solve. As far as I remember, this was only needed for Mac users - but is it really so?

lucasconstantino avatar Apr 26 '18 20:04 lucasconstantino

Yea, I totally agree. And yes, I think that was the only problem I had.

renatorib avatar Apr 26 '18 21:04 renatorib

I also had this error. I'm not Mac user. I'm using Debian Linux.

During the installation process, in the file docker-compose.yml..

app:
    extends: meta
    image: taller-chat-app
    build:
      context: ./docker/
      args:
        USER_ID: "$USER_ID"
        GROUP_ID: "$GROUP_ID"
...

I remove args property of taller-chat-app and run make run again, It works totally fine!

francisrod01 avatar Apr 15 '19 16:04 francisrod01