Answer the question
In order to leave comments, you need to log in
How to execute CMD as user in Docker?
I'm running a docker file via docker compose. Question: how to execute the ./build.sh script from the "ubuntu" user created inside the container when starting the container? Because the compiled firmware inside the container in the volume is placed with root rights.
<...>
WORKDIR /root/
COPY ./build.sh .
RUN groupadd --gid 1000 node \
&& useradd --uid 1000 --gid node --shell /bin/bash --create-home ubuntu
USER 1000
USER ubuntu
CMD ["./build.sh"]
Answer the question
In order to leave comments, you need to log in
For compose, you can specify a user with the necessary uid / gid through the environment in this way
https://dev.to/acro5piano/specifying-user-and-grou...
Solution 3 will probably be the most convenient
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question