Running Microsoft Windows [Version 10.0.17763.678] with Docker Desktop Engine 19.03.2
Using Experimental Feeatures in the Daemon settings, hoping to run Linux containers next to Windows containers, and hitting an issue:
The Dockerfile I used to create the Linux image (while Docker was running in Linux mode *),
creates a separate user and sets him using the USER directive.
Running it from that mode works fine, and when running the image with /bin/bash command,
whoami shows developer.
However, when switching to Windows mode with Experimental features on, the USER directive is not met.
Running it from Windows mode with /bin/bash command, the whoami command shows root.
(*) second issue: using apt-get update doesn’t appear to work on build due to outside connection issues ?
RUN apt-get update && apt-get install -y firefox && apt-get install sudo
RUN adduser --disabled-password --gecos “dev,0,container” developer && \
usermod -aG sudo developer && \
echo “developer ALL=(ALL) NOPASSWD: ALL” > /etc/sudoers.d/developer && \
chmod 0440 /etc/sudoers.d/developer
ENV HOME /home/developer
Note: sudo is not by default in 18.04, which is why apt-get picks it up.
Running the image normally, tries to run firefox which will not work as root.
Usage: you have to give it the DISPLAY environment variables for Xming under Windows to work, as well as a local container path for XDG_RUNTIME_DIR.
Windows: use Xming with environment variables IPADDR set to your Windows host IP, and
C:> docker run -ti --rm -e DISPLAY=%IPADDR%:0.0 -e XDG_RUNTIME_DIR=/tmp/.X11-unix image-tag firefox http-url"