USER instruction appears to be ignored for LCOW
solvingj opened this issue · comments
Dockerfile
FROM ubuntu:trusty
RUN useradd -ms /bin/bash testuser \
&& printf "testuser:testuser" | chpasswd \
&& adduser testuser sudo \
&& printf "testuser ALL= NOPASSWD: ALL\\n" >> /etc/sudoers
USER testuser
RUN whoami
CMD whoami
Build Log
c:\Users\me\Desktop>docker build . --platform=linux -t dockeruserfail
Sending build context to Docker daemon 103.4kB
Step 1/5 : FROM ubuntu:trusty
---> 3b853789146f
Step 2/5 : RUN useradd -ms /bin/bash testuser && printf "testuser:testuser" | chpasswd && adduser testuser sudo && printf "testuser ALL= NOPASSWD: ALL\\n" >> /etc/sudoers
---> Using cache
---> b86bffa2a6bf
Step 3/5 : USER testuser
---> Using cache
---> 94849a0d376c
Step 4/5 : RUN whoami
---> Using cache
---> d63f59ce1c1e
Step 5/5 : CMD whoami
---> Using cache
---> e35c44ded873
Successfully built e35c44ded873
Successfully tagged dockeruserfail:latest
c:\Users\me\Desktop>docker run dockeruserfail
root
Environment
Version 18.04.0-ce-win62 (17151)
Channel: edge
e0a85f6
Windows 10 Pro for Workstations Insider Preview
1803
17639.1000
Additionally, adding a RUN
or CMD
instruction at the end to su testuser
has no effect. You also cannot pass su testuser
in the command as in docker run ... /bin/sh -c 'su testuser && whoami'
I hit the same problem too.