Your Location is: Home > Linux

Dockerfile - Create user

From: Iraq View: 2639 Arthur 

Question

I am trying to create a user inside Dockerfile. I have .env file with simple content

USER=user

For some reason the following command is working

RUN       useradd -ms /bin/bash user

And this one did not

RUN       useradd -ms /bin/bash $USER

How can I solve this? I have the env file inside my docker-compose.yml file

...
    env_file:
      - .env
...

Best answer