skip to Main Content

I am facing an issue when adding a user to a Docker container based on the Eclipse Temurin 17-jre image. The command I am using in my Dockerfile is:

RUN adduser --disabled-login -u 1000 spring-boot

However, when I build the image, I get the following error:

Could not build image: The command ‘/bin/sh -c adduser –disabled-login -u 1000 spring-boot’ returned a non-zero code: 127

This command has been working for a long time, but the issue started this morning. I noticed that the latest tag for the 17-jre image was pushed two hours ago, which might be related to this issue.

Is there a different command or package that I need to install before adding a user to this base image? Any help would be appreciated!

3

Answers


  1. adduser command is not present by default in eclipse-temurin:17-jre but useradd is.

    Based on your specifications you can create the spring-boot user like so useradd --uid 1000 --no-create-home --shell /usr/sbin/nologin spring-boot. But beware of the user id 1000 since it is not unique and linked to the ubuntu user.

    Login or Signup to reply.
  2. We’re facing the same issue in eclipse-temurin:21-jdk

    It worked just fine since this morning. The command we were using is:

    useradd <our user> --uid 1000 --disabled-password --no-create-home --gecos ''

    I just installed adduser via apt-get and have a running right now. It is somewhat of a temporary workaround, does anyone have a clue what happened to the base image? Is this a hickup, or was there a plan to remove adduser command from the image?

    Login or Signup to reply.
  3. User ID 1000 is used by the user ubuntu

    docker run eclipse-temurin:17-jre cat /etc/passwd
    

    Will show you that fact.

    The way I used it before (adapting to your use csae) was to do

    RUN echo spring-boot:x:1001:1001:Spring Boot:/nonexistent:/usr/sbin/nologin >> /etc/passwd
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search