Docker
FROM some-base-image
# Do all of the initial setup and build as root
WORKDIR /app
COPY . .
RUN ...
# Create some non-root user that owns the data directory by default
RUN useradd -r myuser # no specific user ID
RUN mkdir /data && chown myuser /data
# VOLUME ["/data"] # optional, the only place VOLUME makes sense at all
# Specify how to run the container
USER myuser # not earlier than this
EXPOSE ... # optional but good practice
ENTRYPOINT ["/entrypoint.sh"] # knows how to seed /data, then `exec "$@"`
CMD my_app ... # a complete command line
目录权限问题
https://www.cnblogs.com/woshimrf/p/understand-docker-uid.html
useradd 和 adduser
sudo 问题
https://blog.csdn.net/boling_cavalry/article/details/93380447