Linux Alpine 的默认用户是什么?
What is the default user for Linux Alpine?
我是 运行 这里的 Dockerfile,在跟随 this 设置 memcached 之后,我想 "change back" 给普通的 Linux Alpine 用户。
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"]
这个的语法是什么?我暂时用的是USER root。这个对吗?我没有在 USER memcached
之前的任何地方引用 USER
。
我相信USER root
是正确的。默认 docker 用户通常是 root
。
我能找到的最接近的参考资料是在 Docker USER 命令的文档中:
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.
但是,您自己很容易找到,使用一个简单的 Docker 文件:
FROM python:3.6-alpine
RUN whoami
将输出(如果docker
以 root 或 Docker previliged 用户身份启动):
Step 2/2 : RUN whoami #
---> Running in 3a8d159404cd
root
我是 运行 这里的 Dockerfile,在跟随 this 设置 memcached 之后,我想 "change back" 给普通的 Linux Alpine 用户。
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"]
这个的语法是什么?我暂时用的是USER root。这个对吗?我没有在 USER memcached
之前的任何地方引用 USER
。
我相信USER root
是正确的。默认 docker 用户通常是 root
。
我能找到的最接近的参考资料是在 Docker USER 命令的文档中:
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.
但是,您自己很容易找到,使用一个简单的 Docker 文件:
FROM python:3.6-alpine
RUN whoami
将输出(如果docker
以 root 或 Docker previliged 用户身份启动):
Step 2/2 : RUN whoami #
---> Running in 3a8d159404cd
root