要求:
(1)增加一个新用户,名为mynewuser
(2)让这个用户有root权限
(3)设置其密码为mynewpassword
(4)Container启动后以mynewuser登录,并且直接到mynewuser的home目录下
将下面代码片段放到Dockerfile里面。
RUN useradd --create-home --no-log-init --shell /bin/bash mynewuser
RUN adduser mynewuser sudo
RUN echo 'mynewuser:mynewpassword' | chpasswd
USER mynewuser
WORKDIR /home/mynewuser