最佳答案
使用useradd而不是其交互式adduser来添加用户.
原文链接:https://www.f2er.com/docker/436253.htmlRUN useradd -ms /bin/bash vault
以下命令不会创建用户.
USER vault
WORKDIR /usr/local/bin/vault
它将使用保管库用户
请参考Dockerfile User Documentation
The USER instruction sets the user name or UID to use when running the
image and for any RUN,CMD and ENTRYPOINT instructions that follow it
in the Dockerfile.
注意:确保bash是默认的shell.
如果默认shell是/ bin / sh,你可以这样做:
RUN ln -sf /bin/bash /bin/sh
RUN useradd -ms /bin/bash vault