What is the default user for Linux Alpine?
I believe USER root
is correct. The default docker user is typically root
.
The closest reference I could find is in the Docker docs for the USER command:
https://docs.docker.com/engine/reference/builder/#user
Warning: When the user doesn’t have a primary group then the image (or the next instructions) will be run with the root group.
However, it very easy to find for yourself, using a simple Dockerfile:
FROM python:3.6-alpine
RUN whoami
Will output (either ifdocker
is started as root or as a Docker previliged user):
Step 2/2 : RUN whoami #
---> Running in 3a8d159404cd
root
Related videos on Youtube
Scott Skiles
Working on it: https://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/ https://stackoverflow.com/help/on-topic
Updated on June 04, 2022Comments
-
Scott Skiles over 1 year
I am running a Dockerfile here and want to "change back" to the regular Linux Alpine user, after following this to setup memcached.
FROM python:3.6-alpine # Bunch of Linux / Django / Node stuff COPY boot.sh /boot.sh RUN apk --no-cache add memcached && chmod +x /boot.sh USER memcached CMD ["/boot.sh"] # Change back to default user here USER root ADD docker-entrypoint.sh ENTRYPOINT ["/docker-entrypoint.sh"]
What is the syntax for this? I have used USER root for the time being. Is this correct? I don't reference
USER
anywhere beforeUSER memcached
.