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 before USER memcached
.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With