Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

USER instruction appears to be ignored for LCOW #25

Open
solvingj opened this issue Apr 16, 2018 · 2 comments
Open

USER instruction appears to be ignored for LCOW #25

solvingj opened this issue Apr 16, 2018 · 2 comments

Comments

@solvingj
Copy link

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
@solvingj
Copy link
Author

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'

@spgennard
Copy link

I hit the same problem too.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants