Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support docker-for-win: --vcxsrv, --xwin, --xming... #55

Closed
eine opened this issue Jul 7, 2018 · 45 comments
Closed

Support docker-for-win: --vcxsrv, --xwin, --xming... #55

eine opened this issue Jul 7, 2018 · 45 comments

Comments

@eine
Copy link
Contributor

eine commented Jul 7, 2018

Coming #49.

On Windows 10, I start Xming from a MINGW64 (MSYS2) shell:

XMING_PATH="/c/Program\ Files\ \(x86\)/Xming/Xming.exe"
$XMING_PATH -ac -multiwindow -clipboard

Then, I can execute containers with GUI apps:

docker run -e DISPLAY="`ipconfig | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^10\.0\.*"`:0" 11384eb/sozi sozi

Or, just to make it cleaner:

DOCKER_DISPLAY="`ipconfig | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^10\.0\.*"`:0"
docker run -e DISPLAY="$DOCKER_DISPLAY" 11384eb/sozi sozi

So, I tried using x11docker:

export DISPLAY="`ipconfig | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^10\.0\.*"`:0"
x11docker 11384eb/sozi sozi

But this is the output I get:

$ ./x11docker 11384eb/sozi sozi
./x11docker: line 1146: pstree: command not found
./x11docker: line 1255: /etc/os-release: No such file or directory

x11docker ERROR: Could not find user 'my_user_name' in /etc/passwd.

  Type 'x11docker --help' for usage information
  For debugging, run x11docker in terminal and/or enable option '--verbose'
  or look afterwards at logfile
  Please report issues at https://github.com/mviereck/x11docker

./x11docker: line 453: pstree: command not found
x11docker note: Found remaining container process. Most probably the X session was
  interrupted. Can not stop container because x11docker does not run as root.
  Will wait up to 10 seconds for docker to finish.

x11docker note: Waiting for container to terminate ...

x11docker note: Waiting for container to terminate ...

...

x11docker note: Container did not terminate as it should.
  Will not clean cache to avoid file permission issues.
  You can remove the new container with command:
    docker rm -f
  Afterwards, remove cache files with:
    rm -R
  or let x11docker do the cleanup work for you:
    x11docker --cleanup

Adding --hostdiplay didn't help. The error is produced because /etc/passwd does not exist. What's the suggested approach?

@mviereck
Copy link
Owner

mviereck commented Jul 7, 2018

The error is produced because /etc/passwd does not exist.

Yes, that is the core issue here.

x11docker ERROR: Could not find user 'my_user_name' in /etc/passwd.

Is my_user_name the original output, or did you replace it? Can you showme the output ofid?

x11docker tries to run as the unprivileged user that originally logged in. Especially it checks the output of logname and checks /etc/passwd for this user.

What's the suggested approach?

As a first workaround you can set option --user with an arbitrary UID, e.g.

x11docker --user 1111 11384eb/sozi sozi

If the setup works in general, I can try to find better solutions, e.g. regarding a missing /etc/passwd and using other values in that case. If id gives a useable output and HOME exists and is valid, that would help.
Maybe I could even add an option --xming to set up Xming. I would need your help in that case as I don't have a testing environment (no Windows).


Edit: I just realized that the error will occur even with option --user.
You could try to disable line 1684:

#getent passwd $Hostuser >/dev/null 2>&1 || error "Could not find user '$Hostuser' in /etc/passwd."

And replace line 1689:

  Hostuserhome=$(getent passwd $Hostuser | cut -d: -f6)

with something like

Hostuserhome=$HOME

@eine
Copy link
Contributor Author

eine commented Jul 7, 2018

Is my_user_name the original output, or did you replace it? Can you showme the output of id?

It is not. I replaced it because I thought it was not relevant. The original output was 'f555l':

$ logname
f555l

The output of id is:

uid=197609(f555l) gid=197121(None) groups=197121(None),197612(docker-users),197610(HomeUsers),559(Performance Log Users),545(Users),4(INTERACTIVE),66049(CONSOLE LOGON),11(Authenticated Users),15(This Organization),113(Local account),66048(LOCAL),262154(NTLM Authentication),401408(Medium Mandatory Level)

As a first workaround you can set option --user with an arbitrary UID, e.g.

I tried both x11docker --user 1111 11384eb/sozi sozi and x11docker --user 197609 11384eb/sozi sozi (after I checked the output of id). I get the same result as before: Could not find user 'f555l' in /etc/passwd..

If the setup works in general, I can try to find better solutions, e.g. regarding a missing /etc/passwd and using other values in that case. If id gives a useable output and HOME exists and is valid, that would help.

id gives a usable output, and HOME exists and is valid:

$ echo $HOME
/home/f555l

Maybe I could even add an option --xming to set up Xming.

That'd be great. I didn't suggest starting/setting Xming automatically (yet), because I think that it is better to focus on making it work once the server is already running. However, this is the snippet I am using, just in case it is useful to you:

if [ -z "$XMING_PATH" ]; then
  XMING_PATH="/c/Program\ Files\ \(x86\)/Xming/Xming.exe"
fi
if [ -z "$DOCKER_DISPLAY" ]; then
  DOCKER_DISPLAY="`ipconfig | grep 'IPv4' | grep -o '[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*' | grep "^10\.0\.*"`:0"
fi

test_xdpyinfo() { docker run --rm -t -e DISPLAY=$DOCKER_DISPLAY x11docker/xdpyinfo sh -c 'xdpyinfo'; }

if [ -z "$SKIP_TEST" ]; then
  if [ -z $(docker images -q x11docker/xdpyinfo 2> /dev/null) ]; then
    docker pull x11docker/xdpyinfo
  fi

  echo "> Test x11docker/xdpyinfo"
  xdpyinfo_resp=$(test_xdpyinfo)
  if [ -z "$(echo \"$xdpyinfo_resp\" | grep 'unable')" ]; then
    echo "OK"
  else
    echo "$xdpyinfo_resp"
    echo "Can't connect to X server on $DOCKER_DISPLAY."
    if [ "$(uname | cut -c1-5)" = "MINGW" ]; then
      read -r -p "This is a MINGW env. If on Windows, do you want to init XMING? [y/n] " doxming
      case "$doxming" in
        [yY][eE][sS]|[yY])
          if [ -z "$XMING_PATH" ]; then
            echo "> <XMING_PATH> not set!"
            exit 1
          else
            eval "$XMING_PATH -ac -multiwindow -clipboard" 1> /tmp/xming_log.log 2>&1 &
            test_xdpyinfo
          fi
      ;;
      esac
    fi
  fi
fi

DISPLAY=$DOCKER_DISPLAY ./x11docker --user 1111 "$@"

I would need your help in that case as I don't have a testing environment (no Windows).

Sure.

mviereck added a commit that referenced this issue Jul 7, 2018
@mviereck
Copy link
Owner

mviereck commented Jul 7, 2018

I've made an update on master branch that circumvents the /etc/passwd check if it fails.
Can you run x11docker --update-master and check again? You will still need --user=1111, I will fix that next.

Is there really no /etc/passwd? And /etc/group?
x11docker uses command getent to read from this files, maybe only this command is missing and x11docker has to parse /etc/passwd itself.

Another question: Does Xming create a socket in /tmp/.X11-unix? Or is MINGW64 separated from Xming?

@eine
Copy link
Contributor Author

eine commented Jul 7, 2018

I've made an update on master branch that circumvents the /etc/passwd check if it fails.
Can you run x11docker --update-master and check again? You will still need --user=1111, I will fix that next.

x11docker --update-master wouldn't work, because it fails due to /etc/passwd being missing. Anyway, since I cloned the git repo, I just pulled the change. Just for you to know.

Now, a warning is shown, but the same error happens later:

./x11docker: line 1146: pstree: command not found
x11docker WARNING: Your system misses /etc/passwd

x11docker ERROR: Could not find user 'f555l' in /etc/passwd.

  Type 'x11docker --help' for usage information
  For debugging, run x11docker in terminal and/or enable option '--verbose'
  or look afterwards at logfile
  Please report issues at https://github.com/mviereck/x11docker

./x11docker: line 453: pstree: command not found
x11docker note: Found remaining container process. Most probably the X session was
  interrupted. Can not stop container because x11docker does not run as root.
  Will wait up to 10 seconds for docker to finish.

x11docker note: Waiting for container to terminate ...

x11docker note: Waiting for container to terminate ...

...

x11docker note: Container did not terminate as it should.
  Will not clean cache to avoid file permission issues.
  You can remove the new container with command:
    docker rm -f
  Afterwards, remove cache files with:
    rm -R
  or let x11docker do the cleanup work for you:
    x11docker --cleanup

Is there really no /etc/passwd? And /etc/group?

None of them:

$ ls -la /etc
total 133
drwxr-xr-x 1 f555l None     0 Jul  7 06:24 .
drwxr-xr-x 1 f555l None     0 Jun  6 13:22 ..
-rw-r--r-- 1 f555l None   622 Jun  4 08:32 bash.bash_logout
-rw-r--r-- 1 f555l None  2245 Jun  4 08:32 bash.bashrc
-rw-r--r-- 1 f555l None  1285 Jun  4 08:32 config.site
-rw-r--r-- 1 f555l None  4196 May 31 09:41 DIR_COLORS
-rw-r--r-- 1 f555l None   227 Jun  4 08:32 fstab
drwxr-xr-x 1 f555l None     0 Jun  7  2016 fstab.d
-rw-r--r-- 1 f555l None   827 May 11  2016 hosts
drwxr-xr-x 1 f555l None     0 Jul  7 15:51 krb5
-rw-r--r-- 1 f555l None  2335 Jan 25 06:19 localtime
-rw-r--r-- 1 f555l None  6192 Jul  6 23:34 makepkg.conf
-rw-r--r-- 1 f555l None  6699 Jul  6 23:34 makepkg_mingw32.conf
-rw-r--r-- 1 f555l None  6756 Jul  6 23:34 makepkg_mingw64.conf
-rw-r--r-- 1 f555l None  1826 Jun  4 08:32 msystem
lrwxrwxrwx 1 f555l None    12 Jun  7  2016 mtab -> /proc/mounts
-rw-r--r-- 1 f555l None   407 Aug 22  2013 networks
-rw-r--r-- 1 f555l None   177 Jun  4 08:32 nsswitch.conf
-rw-r--r-- 1 f555l None  2566 Jul  6 23:34 pacman.conf
drwxr-xr-x 1 f555l None     0 Jul  7 06:24 pacman.d
drwxr-xr-x 1 f555l None     0 Dec 19  2017 pkcs11
drwxr-xr-x 1 f555l None     0 Jun  7  2016 pki
drwxr-xr-x 1 f555l None     0 Jun  6 12:58 post-install
-rw-r--r-- 1 f555l None  6698 Jun  4 08:32 profile
drwxr-xr-x 1 f555l None     0 Jul  7 15:50 profile.d
-rw-r--r-- 1 f555l None  1358 Aug 22  2013 protocols
-rw-r--r-- 1 f555l None 17463 Aug 22  2013 services
-rw-r--r-- 1 f555l None    87 Sep 11  2017 shells
drwxr-xr-x 1 f555l None     0 Jun  6 13:07 skel
drwxr-xr-x 1 f555l None     0 May 29 15:32 ssh
-rw-r--r-- 1 f555l None  5000 Feb  8 13:33 wgetrc
drwxr-xr-x 1 f555l None     0 Jun  7  2016 xml

x11docker uses command getent to read from this files, maybe only this command is missing and x11docker has to parse /etc/passwd itself.

The command is missing, but it is available through pacman:

$ pacman -Ss getent
msys/getent 2.18.90-2 (base)
    Get entries from Name Service Switch libraries

I installed it and executed x11docker again:

NOTE: there are lots of read error lines, so I removed most of them and replaced them with ....

./x11docker: line 1146: pstree: command not found
x11docker note: You are running a beta version of x11docker.
  Beta versions change often and may introduce temporary new bugs.
  If you prefer latest stable release, run 'x11docker --update'.
  If you prefer to follow development, run 'x11docker --update-master'.

  You can contribute to x11docker if you find bugs and report them at:
    https://github.com/mviereck/x11docker

./x11docker: line 1749: /etc/os-release: No such file or directory
x11docker note: Using X server option --hostdisplay

x11docker note: Command 'xdpyinfo' not found. Need it to check
  whether Xorg supports untrusted cookies for --hostdisplay.
  Please install 'xdpyinfo'.

x11docker note: To allow protection against X security leaks,
  please install one or more of:
    xpra, Xephyr, nxagent, weston+Xwayland, kwin_wayland+Xwayland or Xnest,
  or run a second Xorg server with option --xorg.

x11docker WARNING: Option --hostdisplay provides only low container isolation!
  It is recommended to use another X server option like --xpra or --nxagent.

  To improve security with --hostdisplay x11docker uses untrusted cookies.
  This can lead to strange behaviour of some applications.

  If you encounter application errors, enable option --clipboard
  that disables security restrictions for --hostdisplay as a side effect.

x11docker WARNING: Your host X server runs without cookie authentication.

x11docker note: Could not determine your screen size.
  Please improve this by installing one of xrandr, xdpyinfo or xwininfo.
  Or use option --size=XxY.

./x11docker: line 2748: cvt: command not found
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
x11docker WARNING: Can not find a terminal emulator that works for
  option --hostdisplay. Please install one of:
  xterm lxterm lxterminal stterm sakura termit pterm terminator terminology Eterm konsole qterminal gnome-terminal mate-terminal mrxvt rxvt xvt kterm mlterm xfce4-terminal

realpath: /snap/docker/current/usr/bin/docker-init: No such file or directory
x11docker note: Did not find container init system 'tini'.
  This is a bug in your distributions docker package.
  Normally, docker provides init system tini as '/usr/bin/docker-init'.

  x11docker uses tini for clean process handling and fast container shutdown.
  To provide tini yourself, please download tini-static:
    https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
  Store it in one of:
    /home/f555l/.local/share/x11docker/
    /usr/local/share/x11docker/

./x11docker: line 611: echo: write error: Communication error on send
./x11docker: line 596: read: read error: 0: Communication error on send
...
./x11docker: line 596: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 596: read: read error: 0: Communication error on send
...
./x11docker: line 596: read: read error: 0: Communication error on send
-d Running xinitrc:VERBOSE
./x11docker: line 596: read: read error: 0: Communication error on send
...
./x11docker: line 596: read: read error: 0: Communication error on send
Requesting untrusted cookie from X server:VERBOSE
./x11docker: line 596: read: read error: 0: Communication error on send
...
./x11docker: line 596: read: read error: 0: Communication error on send
Could not create untrusted cookie.
  Maybe your X server misses extension SECURITY.:NOTE
Memory access failures and rendering glitches may occur
  due to unrestricted cookie.
  Avoid them with isolation breaking option --hostipc,
  or use another X server option like --xpra or --nxagent.:WARNING
SECURITY RISK! Keylogging and remote host control
  may be possible! Better avoid using option --hostdisplay,
  rather use --xpra or --nxagent.:WARNING
./x11docker: line 596: read: read error: 0: Communication error on send
...
./x11docker: line 596: read: read error: 0: Communication error on send
Failed to retrieve cookie from X server. Will bake one myself.:VERBOSE
./x11docker: line 596: read: read error: 0: Communication error on send
...
./x11docker: line 617: read: read error: 0: Communication error on send
DEBUGNOTE:(23:13:11) Received SIGINT
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
DEBUGNOTE:(23:13:11) Terminating x11docker.
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 453: pstree: command not found
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
DEBUGNOTE:(23:13:11) Process tree of container:

./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
DEBUGNOTE:(23:13:11) List of stored background processes:
3468 watchpidlist
3228 watchmessagefifo
8760 containershell
./x11docker: line 617: read: read error: 0: Communication error on send
...
ps: unknown option -- no-headers
Try `ps --help' for more information.
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
DEBUGNOTE:(23:13:12) Checking: 8760 (containershell):
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
ps: unknown option -- no-headers
Try `ps --help' for more information.
./x11docker: line 617: read: read error: 0: Communication error on send
DEBUGNOTE:(23:13:12) Terminating 8760 (containershell) x11docker:
./x11docker: line 617: read: read error: 0: Communication error on send
...
ps: unknown option -- no-headers
Try `ps --help' for more information.
./x11docker: line 617: read: read error: 0: Communication error on send
DEBUGNOTE:(23:13:12) Checking: 3228 (watchmessagefifo):
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
ps: unknown option -- no-headers
Try `ps --help' for more information.
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
DEBUGNOTE:(23:13:12) Terminating 3228 (watchmessagefifo) x11docker:
./x11docker: line 617: read: read error: 0: Communication error on send
./x11docker: line 617: read: read error: 0: Communication error on send
ps: unknown option -- no-headers
Try `ps --help' for more information.
DEBUGNOTE:(23:13:13) Checking: 3468 (watchpidlist):
DEBUGNOTE:(23:13:13) time to say goodbye (finish)
./x11docker: line 570: echo: write error: Communication error on send
x11docker note: Found remaining container process. Most probably the X session was
  interrupted. Can not stop container because x11docker does not run as root.
  Will wait up to 10 seconds for docker to finish.

x11docker note: Waiting for container to terminate ...

...

x11docker note: Container did not terminate as it should.
  Will not clean cache to avoid file permission issues.
  You can remove the new container with command:
    docker rm -f x11docker_X0_2f6e7c_11384eb-sozi
  Afterwards, remove cache files with:
    rm -R /home/f555l/.cache/x11docker/X51-11384eb-sozi
  or let x11docker do the cleanup work for you:
    x11docker --cleanup

DEBUGNOTE:(23:13:24) Exitcode 0

Another question: Does Xming create a socket in /tmp/.X11-unix? Or is MINGW64 separated from Xming?

MINGW64 is separated from Xming. I execute Xming from the bash, as shown above, but I could achieve the same result if I launched it with XLaunch. Indeed the options I use (-ac -multiwindow -clipboard) are equivalent to selecting Multiple windows, Start no client, Clipboard and No Access Control in the GUI.

Therefore, no /tmp/.X11-unix socket is created. Note that /tmp is in fact C:\msys64\tmp. However, Xming might be creating that socket somewhere else. Let me investigate and I'll tell you if I find anything.

EDIT: See https://unix.stackexchange.com/questions/207365/x-flag-x11-forwarding-does-not-appear-to-work-in-windows. Therefore, when I use ipconfig and grep to set DISPLAY I am finding the socket, which is TCP instead of a unix socket.

For now, this is the log of Xming:

$ cat /tmp/xming_log.log
Welcome to the Xming X Server
Vendor: Colin Harrison
Release: 6.9.0.31
FreeType2: 2.3.4
Contact: http://sourceforge.net/forum/?group_id=156984

Xming was started with the following command line...
C:\Program Files (x86)\Xming\Xming.exe -ac -multiwindow
 -clipboard

(**) FontPath set to "built-ins,C:\Program Files (x86)\Xming/fonts/misc/,C:\Program Files (x86)\Xming/fonts/TTF/,C:\Program Files (x86)\Xming/fonts/Type1/,C:\Program Files (x86)\Xming/fonts/75dpi/,C:\Program Files (x86)\Xming/fonts/100dpi/,C:\Program Files\Xming\fonts\dejavu,C:\Program Files\Xming\fonts\cyrillic,C:\WINDOWS\Fonts"
(==) RgbPath set to "C:\Program Files (x86)\Xming\rgb.txt"
(==) Logfile set to "C:\msys64\tmp\Xming.0.log"
Welcome to the Xming X Server
Vendor: Colin Harrison
Release: 6.9.0.31
FreeType2: 2.3.4
Contact: http://sourceforge.net/forum/?group_id=156984

C:\Program Files (x86)\Xming\Xming.exe -ac -multiwindow
 -clipboard

XdmcpRegisterConnection: newAddress 10.0.75.1
winValidateArgs - g_iNumScreens: 1 iMaxConsecutiveScreen: 1
winDetectSupportedEngines - Windows NT/2000/XP
winDetectSupportedEngines - DirectDraw installed
winDetectSupportedEngines - DirectDraw4 installed
winDetectSupportedEngines - Returning, supported engines 00000007
winSetEngine - Multi Window or Rootless => ShadowGDI
winAdjustVideoModeShadowGDI - Using Windows display depth of 32 bits per pixel
winAllocateFBShadowGDI - Creating DIB with width: 1366 height: 768 depth: 32
winFinishScreenInitFB - Masks: 00ff0000 0000ff00 000000ff
winInitVisualsShadowGDI - Masks 00ff0000 0000ff00 000000ff BPRGB 8 d 24 bpp 32
glWinInitVisuals:1596: glWinInitVisuals
glWinInitVisualConfigs:1503: glWinInitVisualConfigs glWinSetVisualConfigs:1581: glWinSetVisualConfigs
init_visuals:1055: init_visuals
null screen fn ReparentWindow
null screen fn RestackWindow
InitQueue - Calling pthread_mutex_init
InitQueue - pthread_mutex_init returned
InitQueue - Calling pthread_cond_init
InitQueue - pthread_cond_init returned
winInitMultiWindowWM - Hello
winInitMultiWindowWM - Calling pthread_mutex_lock ()
winMultiWindowXMsgProc - Hello
winMultiWindowXMsgProc - Calling pthread_mutex_lock ()
glWinScreenProbe:1390: glWinScreenProbe
fixup_visuals:1303: fixup_visuals
init_screen_visuals:1336: init_screen_visuals
(--) 3 mouse buttons found
(--) Setting autorepeat to delay=500, rate=31
(--) winConfigKeyboard - Layout: "0000040A" (0000040a)
(--) Using preset keyboard for "Spanish (Spain, Traditional Sort)" (40a), type "7"
Rules = "xorg" Model = "pc105" Layout = "es" Variant = "(null)" Options = "(null)"
Could not init font path element C:\Program Files (x86)\Xming/fonts/misc/, removing from list!
Could not init font path element C:\Program Files (x86)\Xming/fonts/TTF/, removing from list!
Could not init font path element C:\Program Files (x86)\Xming/fonts/Type1/, removing from list!
Could not init font path element C:\Program Files (x86)\Xming/fonts/75dpi/, removing from list!
Could not init font path element C:\Program Files (x86)\Xming/fonts/100dpi/, removing from list!
Could not init font path element C:\Program Files\Xming\fonts\dejavu, removing from list!
Could not init font path element C:\Program Files\Xming\fonts\cyrillic, removing from list!
Could not init font path element C:\WINDOWS\Fonts, removing from list!
winPointerWarpCursor - Discarding first warp: 683 384
winInitMultiWindowWM - pthread_mutex_lock () returned.
winInitMultiWindowWM - pthread_mutex_unlock () returned.
winMultiWindowXMsgProc - pthread_mutex_lock () returned.
winMultiWindowXMsgProc - pthread_mutex_unlock () returned.
winMultiWindowXMsgProc - DISPLAY=127.0.0.1:0.0
winInitMultiWindowWM - DISPLAY=127.0.0.1:0.0
winProcEstablishConnection - Hello
winInitClipboard ()
winProcEstablishConnection - winInitClipboard returned.
winClipboardProc - Hello
DetectUnicodeSupport - Windows Vista
winClipboardProc - DISPLAY=127.0.0.1:0.0

EDIT:

I saw your edit to #55 (comment) now. However, I think that the edition of those two lines is not required after I installed getent, is it?

@mviereck
Copy link
Owner

mviereck commented Jul 8, 2018

Now, a warning is shown, but the same error happens later

ups, sorry, I missed to change the message from error to warning. Is fixed now.

Is there really no /etc/passwd? And /etc/group?

None of them

Strange, i wonder where id gets its data from.

NOTE: there are lots of read error lines, so I removed most of them and replaced them with ....

That's a serious issue. For internal communication x11docker makes extensive use of mkfifo and bash file descriptors created with exec pointing to the created fifo files. I don't see a bash error message about mkfifo so it seems the command itself is available?
I could create a temporary fork that disables this communication to have a base for further testing. But it would be too hard to remove this from x11docker in general. (It is used for process watching and for message forwarding from subshells and container to the main process.)


I have downloaded a VirtualBox image with Windows 7 and installed MINGW64 and MSYS into it. But it seems I have to redo this, I just clicked ok to everything and hoped it would work. I found a bash.exe and ran it, but no commands are found inside. Seems I have to RTFM :-p.
Do you have a recommendation for an easy setup-HowTo just to test the given issues?


About XMing: Do i see it right that there is only a version from 2007 available for the public? I found no possibility to download a recent version either from the homepage or from sourceforge. In that case I hesitate to include an option --xming, but still would like to get x11docker to run within MINGW64. Xming could still be started manually as you did above.

@eine
Copy link
Contributor Author

eine commented Jul 8, 2018

Strange, i wonder where id gets its data from.

idk.

That's a serious issue. For internal communication x11docker makes extensive use of mkfifo and bash file descriptors created with exec pointing to the created fifo files. I don't see a bash error message about mkfifo so it seems the command itself is available?

Yes, mkfifo is available:

$ mkfifo --help
Usage: mkfifo [OPTION]... NAME...
Create named pipes (FIFOs) with the given NAMEs.

Mandatory arguments to long options are mandatory for short options too.
  -m, --mode=MODE    set file permission bits to MODE, not a=rw - umask
  -Z                   set the SELinux security context to default type
      --context[=CTX]  like -Z, or if CTX is specified then set the SELinux
                         or SMACK security context to CTX
      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/mkfifo>
or available locally via: info '(coreutils) mkfifo invocation'

$ mkfifo --version
mkfifo (GNU coreutils) 8.26
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

I could create a temporary fork that disables this communication to have a base for further testing. But it would be too hard to remove this from x11docker in general. (It is used for process watching and for message forwarding from subshells and container to the main process.)

I think it is not worth. Instead of doing that, I would just use a wrapper like the one above that uses x11docker on linux only, and a simpler procedure for windows.

I have downloaded a VirtualBox image with Windows 7 and installed MINGW64 and MSYS into it. But it seems I have to redo this, I just clicked ok to everything and hoped it would work. I found a bash.exe and ran it, but no commands are found inside. Seems I have to RTFM :-p.
Do you have a recommendation for an easy setup-HowTo just to test the given issues?

I normally install the 64bit version from: https://www.msys2.org/
Then, execute either C:/msys64/msys2, C:/msys64/mingw64 or C:/msys64/mingw32. There you'll get a bash shell. Then, use the package manager (pacman) to update the system (pacman -Suy), to search for packages (pacman -Ss <package_name>) and to install the packages you need (pacman -S <package_name>).

Installing docker needs to be done independently. I have only used the Windows 10 version (https://docs.docker.com/docker-for-windows/install/) that seems to be different from the solution for windows 7 (https://docs.docker.com/toolbox/toolbox_install_windows/).

About XMing: Do i see it right that there is only a version from 2007 available for the public? I found no possibility to download a recent version either from the homepage or from sourceforge. In that case I hesitate to include an option --xming, but still would like to get x11docker to run within MINGW64. Xming could still be started manually as you did above.

You are right. AFAIK, that's the single open source version available.

A more recent alternative is https://sourceforge.net/projects/vcxsrv/files/vcxsrv/1.20.0.0/ See also https://superuser.com/questions/1165151/difference-between-x-servers-in-windows

@eine eine closed this as completed Jul 8, 2018
@eine eine reopened this Jul 8, 2018
@mviereck
Copy link
Owner

mviereck commented Jul 9, 2018

I normally install the 64bit version from: https://www.msys2.org/ [...]

Thanks, now I have a usable msys2-bash in Windows.
I can reproduce the read error with a few lines:


IEUser@IEWIN7 MSYS ~
# mkfifo /tmp/myfifo

IEUser@IEWIN7 MSYS ~
# exec 3<>/tmp/myfifo

IEUser@IEWIN7 MSYS ~
# echo foo >&3
bash: echo: write error: Communication error on send

IEUser@IEWIN7 MSYS ~
# read var <&3
bash: read: read error: 0: Communication error on send

IEUser@IEWIN7 MSYS ~
# cat /tmp/myfifo
cat: /tmp/myfifo: Device or resource busy

IEUser@IEWIN7 MSYS ~
# ls -l /tmp/myfifo
prw-rw-rw- 1 IEUser None 0 Jul  9 14:55 /tmp/myfifo

Same commands run well on several real linux systems, example from debian buster:

lauscher@buster:~$ mkfifo /tmp/myfifo
lauscher@buster:~$ exec 3<>/tmp/myfifo
lauscher@buster:~$ echo foo >&3
lauscher@buster:~$ read var <&3
lauscher@buster:~$ echo $var
foo
lauscher@buster:~$ cat /tmp/myfifo

^C
lauscher@buster:~$ ls -l /tmp/myfifo
prw-r--r-- 1 lauscher lauscher 0 Jul 10 00:03 /tmp/myfifo

Maybe I missed something, but this seems to me like a bug in MSYS2. Or do you have an idea about this?

Installing docker needs to be done independently. I have only used the Windows 10 version (https://docs.docker.com/docker-for-windows/install/) that seems to be different from the solution for windows 7 (https://docs.docker.com/toolbox/toolbox_install_windows/).

Ok, yes, on win7 I also need VirtualBox. If I can fix the mkfifo issue, I will try a win10 image to install docker.

A more recent alternative is https://sourceforge.net/projects/vcxsrv/files/vcxsrv/1.20.0.0/ See also https://superuser.com/questions/1165151/difference-between-x-servers-in-windows

That looks quite interesting, is up to date and has a free license, thanks!

@eine
Copy link
Contributor Author

eine commented Jul 10, 2018

Maybe I missed something, but this seems to me like a bug in MSYS2. Or do you have an idea about this?

I asked the MSYS2 developer (msys2/MSYS2-packages#1333) and he pointed me to Cygwin. I could reproduce the error/bug in Cygwin. However, having it fixed seems not to be straightforward, or at least not consistent:

Some people seem to have made it work:

But, in the end, bash might not be the best 'language' to tackle this. E.g. python provides an abstraction to do so:

So, I think that we have four options here:

  • Find the underlying issue in Cygwin, if possible, and probably adapt x11docker to use the limited named pipe support.
  • Use an intermediate abstraction layer (say Python) between x11docker and the host.
  • As soon as --xming or --windows is detected, ignore most of the good extra features in x11docker and just launch the container with the display envvar.
  • Have a wrapper, say x11docker-multi, that detects --xming or --windows and calls x11docker only when these are not present.

The first two would add too much overhead to an otherwise straightforward solution, so I believe you might want to avoid them. However, let me know what you think about it.

As long as my initial motivation to open this issue is concerned, I think that we have found the underlying issue. So, feel free to close it whenever you want.

@mviereck
Copy link
Owner

Thank you for your research!

I found a workaround for the mkfifo/exec setup that works on MSYS2.
Also I fixed several minor issues appearing in test runs.

I've downloaded a Win10 VirtualBox image, but failed to run docker inside it. It seems docker cannot run in a Win10 virtual machine, or I have to set something up I've missed so far.

Current state: If DISPLAY is set and command docker is executeable, x11docker is supposed to work on MSYS2.

@mviereck
Copy link
Owner

mviereck commented Jul 13, 2018

I've made an update with new option --vcxsrv to support VcXsrv X server on Windows within MSYS2 and WSL/Ubuntu-on-Windows.

x11docker searches in /c/Program Files/VcXsrv and /mnt/c/Program Files/VcXsrv for vcxsrv.exe. Autodetection works, too, so if you run a blanc x11docker command, it will open a VcXsrv window.

Implementation of option --vcxsrv is not ready yet, but basically it works.

@mviereck
Copy link
Owner

Implementation of --vcxsrv is almost ready.

Still missing: cookie authentication. xauth.exe fails to create a cookie, but does not show an error. Without cookie authentication everyone in the network can access VcXsrv.

Further points to check out: pulseaudio sound, maybe hardware acceleration.

Please try out and report any issues.

@eine
Copy link
Contributor Author

eine commented Jul 15, 2018

I found a workaround for the mkfifo/exec setup that works on MSYS2.
Also I fixed several minor issues appearing in test runs.

That's great!

I've downloaded a Win10 VirtualBox image, but failed to run docker inside it. It seems docker cannot run in a Win10 virtual machine, or I have to set something up I've missed so far.

I think that VirtualBox might not support nested virtualization :S. Actually, 'docker-for-win' in Win10 runs on top of a very lightview Alpine Linux based VM running on the Hyper-V: https://forums.virtualbox.org/viewtopic.php?f=6&t=86112.

Current state: If DISPLAY is set and command docker is executeable, x11docker is supposed to work on MSYS2.

x11docker searches in /c/Program Files/VcXsrv and /mnt/c/Program Files/VcXsrv for vcxsrv.exe. Autodetection works, too, so if you run a blanc x11docker command, it will open a VcXsrv window.

I tried ./x11docker --vcxsrv simexp/octave octave:

x11docker note: You are running a beta version of x11docker.
  Beta versions change often and may introduce temporary new bugs.
  If you prefer latest stable release, run 'x11docker --update'.
  If you prefer to follow development, run 'x11docker --update-master'.

  You can contribute to x11docker if you find bugs and report them at:
    https://github.com/mviereck/x11docker

x11docker WARNING: Could not check whether x11docker is running over ssh.
  Please install pstree.

+ Terminallist='xterm lxterm lxterminal stterm sakura termit pterm terminator terminology Eterm konsole qterminal gnome-terminal mate-terminal mrxvt rxvt xvt kterm mlterm xfce4-terminal NOLUCK'
+ '[' -z 10.0.75.1:1001 ']'
+ for Pullterminal in $Terminallist
+ command -v xterm
+ for Pullterminal in $Terminallist
+ command -v lxterm
+ for Pullterminal in $Terminallist
+ command -v lxterminal
+ for Pullterminal in $Terminallist
+ command -v stterm
+ for Pullterminal in $Terminallist
+ command -v sakura
+ for Pullterminal in $Terminallist
+ command -v termit
+ for Pullterminal in $Terminallist
+ command -v pterm
+ for Pullterminal in $Terminallist
+ command -v terminator
+ for Pullterminal in $Terminallist
+ command -v terminology
+ for Pullterminal in $Terminallist
+ command -v Eterm
+ for Pullterminal in $Terminallist
+ command -v konsole
+ for Pullterminal in $Terminallist
+ command -v qterminal
+ for Pullterminal in $Terminallist
+ command -v gnome-terminal
+ for Pullterminal in $Terminallist
+ command -v mate-terminal
+ for Pullterminal in $Terminallist
+ command -v mrxvt
+ for Pullterminal in $Terminallist
+ command -v rxvt
+ for Pullterminal in $Terminallist
+ command -v xvt
+ for Pullterminal in $Terminallist
+ command -v kterm
+ for Pullterminal in $Terminallist
+ command -v mlterm
+ for Pullterminal in $Terminallist
+ command -v xfce4-terminal
+ for Pullterminal in $Terminallist
+ command -v NOLUCK
+ '[' NOLUCK = NOLUCK ']'
+ warning 'Can not find a terminal emulator that works for
  option --vcxsrv. Please install one of:
  xterm lxterm lxterminal stterm sakura termit pterm terminator terminology Eterm konsole qterminal gnome-terminal mate-terminal mrxvt rxvt xvt kterm mlterm xfce4-terminal '
+ '[' no = no ']'
+ echo 'x11docker WARNING: Can not find a terminal emulator that works for
  option --vcxsrv. Please install one of:
  xterm lxterm lxterminal stterm sakura termit pterm terminator terminology Eterm konsole qterminal gnome-terminal mate-terminal mrxvt rxvt xvt kterm mlterm xfce4-terminal
'
x11docker WARNING: Can not find a terminal emulator that works for
  option --vcxsrv. Please install one of:
  xterm lxterm lxterminal stterm sakura termit pterm terminator terminology Eterm konsole qterminal gnome-terminal mate-terminal mrxvt rxvt xvt kterm mlterm xfce4-terminal

+ logentry 'x11docker WARNING: Can not find a terminal emulator that works for
  option --vcxsrv. Please install one of:
  xterm lxterm lxterminal stterm sakura termit pterm terminator terminology Eterm konsole qterminal gnome-terminal mate-terminal mrxvt rxvt xvt kterm mlterm xfce4-terminal
'
+ '[' /home/eine/.cache/x11docker/X1001-simexp-octave/share/x11docker.log ']'
+ echo 'x11docker WARNING: Can not find a terminal emulator that works for
  option --vcxsrv. Please install one of:
  xterm lxterm lxterminal stterm sakura termit pterm terminator terminology Eterm konsole qterminal gnome-terminal mate-terminal mrxvt rxvt xvt kterm mlterm xfce4-terminal
'
+ '[' -z '' ']'
+ '[' -n '' ']'
+ case $Pullterminal in
+ Pullterminal='NOLUCK -e'
+ '[' -z 'bash -c' ']'
+ Anyterminal='NOLUCK -e'
+ '[' -z 10.0.75.1:1001 ']'
+ set +x
x11docker note: Did not find container init system 'tini'.
  This is a bug in your distributions docker package.
  Normally, docker provides init system tini as '/usr/bin/docker-init'.

  x11docker uses tini for clean process handling and fast container shutdown.
  To provide tini yourself, please download tini-static:
    https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
  Store it in one of:
    /home/eine/.local/share/x11docker/
    /usr/local/share/x11docker/

x11docker WARNING: X server VcXsrv runs without cookie authentication.

x11docker WARNING: X server --vcxsrv allows access to X for everyone with 'xhost +'.

/home/eine/.cache/x11docker/X1001-simexp-octave/dockerrc: line 98: NOLUCK: command not found
x11docker WARNING: Failed to wait for file creation of
  /home/eine/.cache/x11docker/X1001-simexp-octave/pullready

x11docker WARNING: Container startup seems to have failed!

  Last lines of container.log:


  Last lines of command stderr:


  Last lines of command stdout:



x11docker ERROR: Image 'simexp/octave' not found locally and not pulled from docker hub.

  Last lines of log:

  Type 'x11docker --help' for usage information
  For debugging, run x11docker in terminal and/or enable option '--verbose'
  or look afterwards at logfile /home/eine/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

ERROR: Invalid argument/option - 'C:/msys64/PID'.
Type "TASKKILL /?" for usage.
ERROR: Invalid argument/option - 'C:/msys64/PID'.
Type "TASKKILL /?" for usage.
./x11docker: line 431: /home/eine/.cache/x11docker/X1001-simexp-octave/share/x11docker.log: No such file or directory
./x11docker: line 431: /home/eine/.cache/x11docker/X1001-simexp-octave/share/x11docker.log: No such file or directory

An instance of VcXsrv was started and is still running (:1001.0).
If I execute the command again, I get the same output in the console but, on top of that, a diferent instance is executed (:1002.0).

@mviereck
Copy link
Owner

I think that VirtualBox might not support nested virtualization :S

I will have a look at VMWare, maybe it supports this szenario.

Your test run:
Ignore + for Pullterminal lines, I forgot to disable a set -x check.

The core issue here: Image 'simexp/octave' not found locally and not pulled from docker hub.

x11docker did not find the image. The check is:

docker inspect --type=image simexp/octave

Can you try this command?

If this checks fails, x11docker tries to pull the image from docker hub. Currently, it needs a GUI terminal for this, but there is none in MSYS2.
x11docker should check if it runs in an interactive terminal and do the pull inside this terminal.

Please try x11docker with an image that is already available.

@eine
Copy link
Contributor Author

eine commented Jul 15, 2018

I now pulled the image prior to running x11docker.

$ ./x11docker --vcxsrv simexp/octave octave
x11docker note: You are running a beta version of x11docker.
  Beta versions change often and may introduce temporary new bugs.
  If you prefer latest stable release, run 'x11docker --update'.
  If you prefer to follow development, run 'x11docker --update-master'.

  You can contribute to x11docker if you find bugs and report them at:
    https://github.com/mviereck/x11docker

x11docker WARNING: Could not check whether x11docker is running over ssh.
  Please install pstree.

+ Terminallist='xterm lxterm lxterminal stterm sakura termit pterm terminator terminology Eterm konsole qterminal gnome-terminal mate-terminal mrxvt rxvt xvt kterm mlterm xfce4-terminal NOLUCK'
...
x11docker note: Did not find container init system 'tini'.
  This is a bug in your distributions docker package.
  Normally, docker provides init system tini as '/usr/bin/docker-init'.

  x11docker uses tini for clean process handling and fast container shutdown.
  To provide tini yourself, please download tini-static:
    https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
  Store it in one of:
    /home/eine/.local/share/x11docker/
    /usr/local/share/x11docker/

x11docker WARNING: X server VcXsrv runs without cookie authentication.

x11docker WARNING: X server --vcxsrv allows access to X for everyone with 'xhost +'.


x11docker ERROR: Startup of docker failed. Did not receive a container ID.

  Last lines of container log:
esourcein\docker.exe: Error response from daemon: Mount denied:
The source path "C:/msys64/home/eine/.cache/x11docker/X1003-simexp-octave/share;C"
doesn't exist and is not known to Docker.
esourcein\docker.exe run --help'.er

  Type 'x11docker --help' for usage information
  For debugging, run x11docker in terminal and/or enable option '--verbose'
  or look afterwards at logfile /home/eine/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

ERROR: Invalid argument/option - 'C:/msys64/PID'.
Type "TASKKILL /?" for usage.
x11docker WARNING: Container startup seems to have failed!

  Last lines of container.log:
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: Mount denied:
The source path "C:/msys64/home/eine/.cache/x11docker/X1003-simexp-octave/share;C"
doesn't exist and is not known to Docker.
See 'C:\Program Files\Docker\Docker\resources\bin\docker.exe run --help'.

  Last lines of command stderr:

  Last lines of command stdout:

ERROR: Invalid argument/option - 'C:/msys64/PID'.
Type "TASKKILL /?" for usage.
./x11docker: line 431: /home/eine/.cache/x11docker/X1003-simexp-octave/share/x11docker.log: No such file or directory
./x11docker: line 431: /home/eine/.cache/x11docker/X1003-simexp-octave/share/x11docker.log: No such file or directory

I think that this might be related to MINGW/MSYS changing some paths from DOS to UNIX format, and viceversa. For example docker run --rm -itv $(pwd):/src busybox ls /src fails in MINGW. The following syntax must be used: docker run --rm -itv /$(pwd)://src busybox ls //src.

If this checks fails, x11docker tries to pull the image from docker hub. Currently, it needs a GUI terminal for this, but there is none in MSYS2.

I saw that on GNU/Linux. Is it possible to automatically download it (as docker cli does) when/if no GUI terminal is available?

@mviereck
Copy link
Owner

Is it possible to automatically download it (as docker cli does) when/if no GUI terminal is available?

I've added mintty to the terminal list. It seems to work fine at least for error messages, hopefully for docker pull, too.

ERROR: Invalid argument/option - 'C:/msys64/PID'.
Type "TASKKILL /?" for usage.

This is a failing taskkill issue, fixed now using cmd.exe /C. MSYS2 seems to have added C:/msys64 to the /PID option of taskkill.exe for unknown reasons. vcxsrv.exe should terminate now if x11docker terminates.

I think that this might be related to MINGW/MSYS changing some paths from DOS to UNIX format, and viceversa. For example docker run --rm -itv $(pwd):/src busybox ls /src fails in MINGW. The following syntax must be used: docker run --rm -itv /$(pwd)://src busybox ls //src.

Good to hear that it is possible, but not nice to implement. Of course, I can add a / to all shared volumes. But custom --volume options would fail, making it less portable.

Interestingly, an additional / does not fail on my debian host, and I've seen that on other Linux systems, too. I could add / to all shared volumes without checking for MSYS2 to keep the code simple. Though, I am not sure if that is specified somewhere.

If we have a specification that pathes like //home are valid in general, I could just add / everywhere.

Maybe MSYS2 somehow provides not to translate pathes in commands; that may be a better solution. Currently I am reading https://github.com/msys2/msys2/wiki/Porting#filesystem-namespaces, it may give a hint.

@mviereck
Copy link
Owner

mviereck commented Jul 15, 2018

I've added / to all pathes in docker command to have a point to start with. Looks ugly, but no issues at least on debian so far.

Some background: https://unix.stackexchange.com/questions/1910/how-does-linux-handle-multiple-consecutive-path-separators-home-username

Cygwin (while not a real UNIX) does translate //remote/... to remote filesystem access,

A pathname that begins with two successive slashes may be interpreted in an implementation-defined manner, although more than two leading slashes shall be treated as a single slash

Maybe the pathes should start with ///. :/

@eine
Copy link
Contributor Author

eine commented Jul 15, 2018

I've added mintty to the terminal list. It seems to work fine at least for error messages, hopefully for docker pull, too.

It works both for error messages and for docker pull.

vcxsrv.exe should terminate now if x11docker terminates.

It does!

I've added / to all pathes in docker command to have a point to start with. Looks ugly, but no issues at least on debian so far.

It is ugly, but it is the single solution I've found so far. At least, I've successfully tried it in Fedora, Ubuntu, Arch, Alpine, MSYS2.

See docker/for-win#1509 and docker/for-win#1829.


This is the ouput I get now:

$ ./x11docker --vcxsrv 11384eb/sozi sozi
x11docker note: You are running a beta version of x11docker.
  Beta versions change often and may introduce temporary new bugs.
  If you prefer latest stable release, run 'x11docker --update'.
  If you prefer to follow development, run 'x11docker --update-master'.

  You can contribute to x11docker if you find bugs and report them at:
    https://github.com/mviereck/x11docker

x11docker WARNING: Could not check whether x11docker is running over ssh.
  Please install pstree.

x11docker note: Did not find container init system 'tini'.
  This is a bug in your distributions docker package.
  Normally, docker provides init system tini as '/usr/bin/docker-init'.

  x11docker uses tini for clean process handling and fast container shutdown.
  To provide tini yourself, please download tini-static:
    https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
  Store it in one of:
    /home/eine/.local/share/x11docker/
    /usr/local/share/x11docker/

x11docker WARNING: X server VcXsrv runs without cookie authentication.

x11docker WARNING: X server --vcxsrv allows access to X for everyone with 'xhost +'.

OCI runtime exec failed: exec failed: container_linux.go:348: starting container process caused "process_linux.go:86: executing setns process caused \"exit status 21\"": unknown
x11docker WARNING: Container startup seems to have failed!

  Last lines of container.log:
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error: No such container: x11docker_X1008_e4af08_11384eb-sozi
Error response from daemon: No such container: x11docker_X1008_e4af08_11384eb-sozi

  Last lines of command stderr:


  Last lines of command stdout:



x11docker ERROR: Got error message from docker daemon:
Error response from daemon: No such container: x11docker_X1008_e4af08_11384eb-sozi

  Type 'x11docker --help' for usage information
  For debugging, run x11docker in terminal and/or enable option '--verbose'
  or look afterwards at logfile /home/eine/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

SUCCESS: The process with PID 1992 (child process of PID 2636) has been terminated.
ERROR: The process "1992" not found.
./x11docker: line 433: /home/eine/.cache/x11docker/X1008-11384eb-sozi/share/x11docker.log: No such file or directory
./x11docker: line 433: /home/eine/.cache/x11docker/X1008-11384eb-sozi/share/x11docker.log: No such file or directory

And, in a new window:

x11docker ERROR

Got error message from docker daemon:
Error response from daemon: No such container: x11docker_X1008_e4af08_11384eb-sozi

  Type x11docker --help for usage information
  For debugging, run x11docker in terminal and/or enable option --verbose
  or look afterwards at logfile /home/eine/.cache/x11docker/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker
(Press any key to close window)

@eine
Copy link
Contributor Author

eine commented Jul 29, 2018

Sure. Sorry about the delay. I was quite busy this week.

EDIT

The previous test was not valid. I had not started docker.

With the latest version from git, this is the output I get:

$ ./x11docker --vcxsrv simexp/octave octave
x11docker note: You are running a beta version of x11docker.
  Beta versions change often and may introduce temporary new bugs.
  If you prefer latest stable release, run 'x11docker --update'.
  If you prefer to follow development, run 'x11docker --update-master'.

  You can contribute to x11docker if you find bugs and report them at:
    https://github.com/mviereck/x11docker

x11docker note: Could not check whether x11docker is running over ssh.
  Please install pstree.

x11docker WARNING: Disabling X authentication for X server --vcxsrv in MSYS.
  An upcoming release of VcXsrv will allow it.

x11docker note: Support of MSYS2, Cygwin and WSL is in an early stage
  of development. If you encounter issues, please report at github.

x11docker WARNING: Option --no-auth: Allowing access to X server for everyone.

x11docker note: Did not find container init system 'tini'.
  This is a bug in your distributions docker package.
  Normally, docker provides init system tini as '/usr/bin/docker-init'.

  x11docker uses tini for clean process handling and fast container shutdown.
  To provide tini yourself, please download tini-static:
    https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
  Store it in one of:
    /home/f555l/.local/share/x11docker/
    /usr/local/share/x11docker/

x11docker WARNING: --vcxsrv: X server :1000 runs without cookie authentication.

x11docker WARNING: Container startup seems to have failed!

  Last lines of container.log:
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/c/Users/f555l/x11docker/cache/X1000-simexp-octave/share': mkdir /host_mnt/c: file exists.
Error: No such container: x11docker_X1000_8c1da9_simexp-octave
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/c/Users/f555l/x11docker/cache/X1000-simexp-octave/share': mkdir /host_mnt/c: file exists.
Error: No such container: 0b74567dac9389edaed580b90223b5d45e2fb04f9fd6d48a49e358927c07d854

  Last lines of command stderr:

  Last lines of command stdout:

x11docker ERROR: Got error message from docker daemon:
esourcein\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/c/Users/f555l/x11docker/cache/X1000-simexp-octave/share': mkdir /host_mnt/c: file exists.

  Type 'x11docker --help' for usage information
  For debugging, run x11docker in terminal and/or enable option '--verbose'
  or look afterwards at logfile /c/Users/f555l/x11docker/cache/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

./x11docker: line 438: /c/Users/f555l/x11docker/cache/X1000-simexp-octave/share/x11docker.log: No such file or directory
./x11docker: line 438: /c/Users/f555l/x11docker/cache/X1000-simexp-octave/share/x11docker.log: No such file or directory

And, in a separate window:

x11docker ERROR

Got error message from docker daemon:
C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: error while creating mount source p
ath /host_mnt/c/Users/f555l/x11docker/cache/X1000-simexp-octave/share: mkdir /host_mnt/c: file exists.

  Type x11docker --help for usage information
  For debugging, run x11docker in terminal and/or enable option --verbose
  or look afterwards at logfile /c/Users/f555l/x11docker/cache/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

Note that I had to ensure that the image was already pulled. Interactively asking to do it does not work (yet). It prompts the user, and I can tell it to pull the image. But the main process closes before the pull is complete.

@mviereck
Copy link
Owner

mviereck commented Jul 29, 2018

Sure. Sorry about the delay. I was quite busy this week.

All is good, thanks for reply and testing!

x11docker ERROR: Password prompt frontend su not found

This error should only occur if a password is needed to run docker. (And no password frontend like su or pkexec is found).
x11docker checks whether docker info >/dev/null succeeds ($?) without a password. This command/the check seems to have failed. Maybe the docker daemon was not running?

Please try again with --pw=none to bypass the password prompt frontend check.

@eine
Copy link
Contributor Author

eine commented Jul 30, 2018

I edited my previous comment. The log there is what I got the first time I executed it. Later executions produce a different error:

$ ./x11docker --vcxsrv simexp/octave octave
x11docker note: You are running a beta version of x11docker.
  Beta versions change often and may introduce temporary new bugs.
  If you prefer latest stable release, run 'x11docker --update'.
  If you prefer to follow development, run 'x11docker --update-master'.

  You can contribute to x11docker if you find bugs and report them at:
    https://github.com/mviereck/x11docker

x11docker note: Could not check whether x11docker is running over ssh.
  Please install pstree.

x11docker WARNING: Disabling X authentication for X server --vcxsrv in MSYS.
  An upcoming release of VcXsrv will allow it.

x11docker note: Support of MSYS2, Cygwin and WSL is in an early stage
  of development. If you encounter issues, please report at github.

x11docker WARNING: Option --no-auth: Allowing access to X server for everyone.

x11docker note: Did not find container init system 'tini'.
  This is a bug in your distributions docker package.
  Normally, docker provides init system tini as '/usr/bin/docker-init'.

  x11docker uses tini for clean process handling and fast container shutdown.
  To provide tini yourself, please download tini-static:
    https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
  Store it in one of:
    /home/f555l/.local/share/x11docker/
    /usr/local/share/x11docker/

x11docker WARNING: --vcxsrv: X server :1000 runs without cookie authentication.

x11docker ERROR: Container startup seems to have failed!

  Last lines of container.log:
mkdir: created directory '/tmp/.font-unix'
total 108
lrwxrwxrwx  1 root root     6 Jul 30 01:01 X1000 -> /X1000
drwxr-xr-x  1 root root  4096 Apr 18  2016 build
drwxr-xr-x  2 root root  4096 Apr 18  2016 hsperfdata_root
-rw-------  1 root root 98236 Apr 18  2016 minc-s0uRmX
drwxr-xr-x 35 root root  4096 Apr 18  2016 minc-toolkit-v2
removed '/etc/shadow'
mkdir: created directory '/fakehome'
x11docker: Container root setup is ready

  Last lines of command stderr:
octave: unable to open X11 DISPLAY
octave: disabling GUI features

  Last lines of command stdout:

  Type 'x11docker --help' for usage information
  For debugging, run x11docker in terminal and/or enable option '--verbose'
  or look afterwards at logfile /c/Users/f555l/x11docker/cache/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

And, in a separate window:

x11docker ERROR

Container startup seems to have failed!

  Last lines of container.log:
mkdir: created directory /tmp/.font-unix
total 108
lrwxrwxrwx  1 root root     6 Jul 30 01:01 X1000 -> /X1000
drwxr-xr-x  1 root root  4096 Apr 18  2016 build
drwxr-xr-x  2 root root  4096 Apr 18  2016 hsperfdata_root
-rw-------  1 root root 98236 Apr 18  2016 minc-s0uRmX
drwxr-xr-x 35 root root  4096 Apr 18  2016 minc-toolkit-v2
removed /etc/shadow
mkdir: created directory /fakehome
x11docker: Container root setup is ready

  Last lines of command stderr:
octave: unable to open X11 DISPLAY
octave: disabling GUI features

  Last lines of command stdout:


  Type x11docker --help for usage information
  For debugging, run x11docker in terminal and/or enable option --verbose
  or look afterwards at logfile /c/Users/f555l/x11docker/cache/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker
(Press any key to close window)

Note that in this case the container started. Indeed, it is still running. However, the GUI (octave) did not launch.

Complete log: x11docker.log

@mviereck
Copy link
Owner

mviereck commented Jul 30, 2018

I see three issues.
The first one is odd:

C:\Program Files\Docker\Docker\resources\bin\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/c/Users/f555l/x11docker/cache/X1000-simexp-octave/share': mkdir /host_mnt/c: file exists.

docker should not try to create that folder. x11docker already did. It should just be shared with container.
Also odd that this error did not reappear on second run.
/host_mnt is not part of x11docker path translation. I assume it is some sort of path translation in docker itself.

Interactively asking to do it does not work (yet). It prompts the user, and I can tell it to pull the image. But the main process closes before the pull is complete.

Ok, I will look at that.

octave: unable to open X11 DISPLAY

This one is surprising. If I run x11docker --vcxsrv --showenv in MSYS2 and run e.g. xterm in Cygwin with the shown DISPLAY, it can access VcXsrv.
Applications in container should be able to access it, too.
Your setup in your first post just uses IP:DISPLAY and -ac. x11docker does the same.
Can you please run with --verbose and store the output at pastebin? Maybe I find a clue in the log.
Or could it be some sort of firewall protection that forbids access over TCP from within container?

@eine
Copy link
Contributor Author

eine commented Jul 30, 2018

/host_mnt is not part of x11docker path translation. I assume it is some sort of path translation in docker itself.

I think that it is where drives are mounted in the (Alpine) VM where docker is being executed. When using docker-for-win and MSYS, there are two possible translation points: MSYS translates UNIX paths to Windows paths, then docker translates/maps the Windows paths to UNIX paths inside the VM. Last, the UNIX paths in the VM are bind to containers (I am not considering windows containers, as I have never used them).

Can you please run with --verbose and store the output at pastebin? Maybe I find a clue in the log.

x11docker.log

Or could it be some sort of firewall protection that forbids access over TCP from within container?

When I first run it I had to accept a warning from the firewall. But not in the next executions.

@mviereck
Copy link
Owner

x11docker checks for container pid in ps output. Because it is not visible in ps of MSYS2 it assumed the container startup has failed.
I have disabled the pid check for MSYS2/Cygwin/WSL.
Please try again, and provide the --verbose log if startup fails for another reason.

@eine
Copy link
Contributor Author

eine commented Jul 30, 2018

It works! Congratulations!

When I exit the application (octave), x11docker and the X server keep running. I need to Ctrl+C to terminate. However, both the container and the X server are properly removed when the script exits.

This is the full log: x11docker.log

@eine eine changed the title Support --xming Support docker-for-win: --vcxsrv, --xming, cygwin/x... Jul 30, 2018
@eine eine changed the title Support docker-for-win: --vcxsrv, --xming, cygwin/x... Support docker-for-win: --vcxsrv, --xming, cygwin/x... Jul 30, 2018
@mviereck
Copy link
Owner

mviereck commented Jul 30, 2018

It works! Congratulations!

hurrah! :-)

Did you also check in Cygwin? (Note that X autodetection in Cygwin/X prefers --xwin over --vcxsrv).

If it works in MSYS2 and Cygwin, most probably it will work in WSL, too. Can you check that, too? It is possible to configure docker in WSL to communicate with docker daemon on windows. Though, if setting that up causes too much trouble, let it be.


However, when I exit the application (octave), x11docker and the X server keep running.

Ok, this happened due to the missing container pid check I've just disabled.
I have implemented a check loop with docker inspect containername now. Though, that adds some CPU usage I'd like to avoid.

On linux hosts I get the container pid with:

ps ax | grep $Containerid | grep -v grep | grep -v ' logs' | awk '{print $1}'

MSYS2 provides ps --windows to show windows processes, too.
Can you check if there is a way to get container pid from ps output in MSYS2? Does the container show up in ps ax --windows?


Interactively asking to do it does not work (yet). It prompts the user, and I can tell it to pull the image. But the main process closes before the pull is complete.

Should be fixed now.


The log shows that the pid of VcXsrv was not stored or not detected at all. I am not sure why, pid detection seems to work reliably here. I have included a warning if the pid of VcXsrv is missing.

@eine
Copy link
Contributor Author

eine commented Jul 31, 2018

Did you also check in Cygwin? (Note that X autodetection in Cygwin/X prefers --xwin over --vcxsrv).

I tried now. First, I had to execute dos2unix x11docker. Although MSYS accepts DOS line endings, cygwin seems to require linux endings. Then I tried ./x11docker --verbose simexp/octave octave. It works too. But it seems to default to --vcxsrv. Do I need to install anything in cygwin in order to use --xwin?

See log: x11docker_cygwin.log

EDIT: I'm installing xinit in cygwin, according to section 'Downloading and Installing' in x.cygwin.com

If it works in MSYS2 and Cygwin, most probably it will work in WSL, too. Can you check that, too? It is possible to configure docker in WSL to communicate with docker daemon on windows. Though, if setting that up causes too much trouble, let it be.

I can try it. But I have never used WSL. I'm installing it now. Do you have any reference about how to configure docker in WSL to communicate with the docker daemon?

EDIT: https://nickjanetakis.com/blog/setting-up-docker-for-windows-and-wsl-to-work-flawlessly

Ok, this happens due to the missing container pid check I've just disabled. I can implement a check loop with docker inspect containername instead. Though, that adds some CPU usage I'd like to avoid.

It works now: x11docker_vcxsrv.log

MSYS2 provides ps --windows to show windows processes, too.
Can you check if there is a way to get container pid from ps output in MSYS2? Does the container show up in ps ax --windows?

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
054b902766a5        simexp/octave       "env /bin/sh - /x11d…"   3 minutes ago       Up 3 minutes                            x11docker_X1000_326f5a_simexp-octave

$ ps ax --windows | grep ocker
    11044       0       0      11044  ?              0 00:59:00 C:\Program Files\Docker\Docker\Docker for Windows.exe
    10728       0       0      10728  ?              0 00:59:44 C:\Program Files\Docker\Docker\resources\vpnkit.exe
     8392       0       0       8392  ?              0 00:59:45 C:\Program Files\Docker\Docker\resources\com.docker.proxy.exe
    11460       1   11120      11460  pty0      197609 03:09:43 /c/Program Files/Docker/Docker/resources/bin/docker
     1516       0       0       1516  ?              0 03:09:43 C:\Program Files\Docker\Docker\resources\bin\docker.exe

and

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

$ ps ax --windows | grep ocker
    11044       0       0      11044  ?              0 00:59:00 C:\Program Files\Docker\Docker\Docker for Windows.exe
    10728       0       0      10728  ?              0 00:59:44 C:\Program Files\Docker\Docker\resources\vpnkit.exe
     8392       0       0       8392  ?              0 00:59:45 C:\Program Files\Docker\Docker\resources\com.docker.proxy.exe

I stopped the container. Then started a new one to check ps only:

$ ps | grep ocker
    10764       1    6312       7100  pty0      197609 03:17:04 /c/Program Files/Docker/Docker/resources/bin/docker

Should be fixed now.

It is: x11docker_pullimg.log I think that it is not required to check it evey second, you can do it every 2-3 secs. Since this is only required the first time you use a image, it is not critical.

The log shows that the pid of VcXsrv was not stored or not detected at all. I am not sure why, pid detection seems to work reliable here. I have included a warning if the pid of VcXsrv is missing.

Let me know if I can help with any additional test.

@eine
Copy link
Contributor Author

eine commented Jul 31, 2018

In cygwin, after installing xinit, --xwin is selected automatically. The X server and the container are created. But no window is opened. If I terminate the script with Ctrl+C the X server is closed, but the container is kept running: x11docker.log

If I execute it without --verbose:

$ ./x11docker simexp/octave octave
x11docker note: You are running a beta version of x11docker.
  Beta versions change often and may introduce temporary new bugs.
  If you prefer latest stable release, run 'x11docker --update'.
  If you prefer to follow development, run 'x11docker --update-master'.

  You can contribute to x11docker if you find bugs and report them at:
    https://github.com/mviereck/x11docker

x11docker note: Could not check whether x11docker is running over ssh.
  Please install pstree.

x11docker note: Using X server option --xwin

x11docker note: Support of MSYS2, Cygwin and WSL is in an early stage
  of development. If you encounter issues, please report at github.

x11docker note: Did not find container init system 'tini'.
  This is a bug in your distributions docker package.
  Normally, docker provides init system tini as '/usr/bin/docker-init'.

  x11docker uses tini for clean process handling and fast container shutdown.
  To provide tini yourself, please download tini-static:
    https://github.com/krallin/tini/releases/download/v0.18.0/tini-static
  Store it in one of:
    /home/f555l/.local/share/x11docker/
    /usr/local/share/x11docker/

x11docker note: setxkbmap not found. Need setxkbmap and xkbcomp to set keyboard layout.

x11docker WARNING: Command 'xhost' not found.
  Can not check for possibly allowed network access to X.
  Please install 'xhost'.

DEBUGNOTE:(05:31:17) Received SIGINT
DEBUGNOTE:(05:31:17) Terminating x11docker.
DEBUGNOTE:(05:31:17) List of stored background processes:
10600 watchpidlist
7772 watchmessagefifo
9064 containershell
DEBUGNOTE:(05:31:18) Checking: 9064 (containershell):
DEBUGNOTE:(05:31:18) Checking: 7772 (watchmessagefifo):
DEBUGNOTE:(05:31:18) Checking: 10600 (watchpidlist):
DEBUGNOTE:(05:31:18) time to say goodbye (finish)
DEBUGNOTE:(05:31:19) Exitcode 0

@mviereck
Copy link
Owner

mviereck commented Jul 31, 2018

I'm installing xinit in cygwin, according to section 'Downloading and Installing' in x.cygwin.com

I've added a hint message if one specifies --xwin.


Thanks for ps checking. It does not look promising, I could not divide between multiple running containers and their matching processes. I'll stay with checking docker inspect $Containername every two seconds.

I think that it is not required to check it evey second, you can do it every 2-3 secs.

The check during docker pull waits an increasing amount of time. x11docker has a waitforfilecreation() function that is used here. The first checks are more than once a second, later checks delay up to several seconds.

x11docker can show the host pid of container pid 1 with --showpid1. Maybe this pid appears in ps --windows. But I doubt it, probably it is the pid within docker alpine VM.


The log shows that the pid of VcXsrv was not stored or not detected at all. I am not sure why, pid detection seems to work reliable here. I have included a warning if the pid of VcXsrv is missing.

Let me know if I can help with any additional test.

I have improved pid check and process watching of VcXsrv. Also I have added a dumb sleep 1 to make sure VcXsrv is ready before X applications try to access it.

Before latest update x11docker checked the Windows pid of VcXsrv with an ugly workaround. Now it relies on the pid reported in ps (without --windows).
Drawback: VcXsrv is not terminated in WSL. On a TERM signal it disappears from WSL process list, but it continues to run on Windows. This is a bug in WSL: microsoft/WSL#1614

@mviereck
Copy link
Owner

mviereck commented Aug 1, 2018

In cygwin, after installing xinit, --xwin is selected automatically. The X server and the container are created. But no window is opened.

octave prints octave: unable to open X11 DISPLAY, but I am not sure why. The log shows that DISPLAY is set correctly and a valid cookie is created. If I run e.g. x11docker --xwin --exe xterm, it works.

Could you run further tests in Cygwin with --xwin as well as --vcxsrv? Additional options to try if startup fails are --no-auth to disable cookie authentication and --desktop to have a visible X server window.

Other than --vcxsrv with TCP connection Xwin provides a unix socket in /tmp/.X11-unix that x11docker shares with container. The log indicates that the socket is shared correctly.
But maybe it is not a real unix socket as it resides on a Windows filesystem in C:/cygwin64/tmp/.X11-unix. It may be a cygwin specific "windows socket" that only works with applications compiled for cygwin.dll.

x11docker may have to connect to Xwin over TCP instead of using the socket. I've allowed TCP for --xwin now. Please try:

./x11docker --xwin --display=1234 --env DISPLAY=10.0.75.1:1234 simexp/octave octave

If I terminate the script with Ctrl+C the X server is closed, but the container is kept running

Should be fixed now.
Can you please test whether $? contains a useful value?

docker inspect nonsensename >/dev/null 2>&1
echo $?      # should be 1 (or non-zero)

docker inspect existing_image_or_container >/dev/null 2>&1
echo $?      # should be 0

First, I had to execute dos2unix x11docker. Although MSYS accepts DOS line endings, cygwin seems to require linux endings.

Do you still need dos2unix? x11docker should translate line endings if needed, but I still may have missed something.

mviereck added a commit that referenced this issue Aug 2, 2018
@eine
Copy link
Contributor Author

eine commented Aug 2, 2018

Do you still need dos2unix? x11docker should translate line endings if needed, but I still may have missed something.

I do:

$ ./x11docker --verbose simexp/octave octave
./x11docker: line 2: $'\r': command not found
./x11docker: line 12: $'\r': command not found
./x11docker: line 14: $'\r': command not found
./x11docker: line 335: $':\r': command not found
./x11docker: line 336: $'}\r': command not found
./x11docker: line 337: syntax error near unexpected token `}'
'/x11docker: line 337: `  } || {

But this might be related to git and cygwin; not something that x11docker can handle. On Windows I have core.autocrlf set to true. Therefore, each time I pull changes the line endings are automatically converted. Since cygwin requires linux style endings, the only solution is for me to disable autocrlf (set it to false). See:

I've added a hint message if one specifies --xwin.

I'll try it again after we get it to work properly (because I need to uninstall the package in order to test it).

Will the message be shown too if no option is specified? i.e. x11docker simexp/octave octave in cygwin. Right now it defaults to --xwin: x11docker_xwin.log

BTW, as you see in the log, the GUI (octave) is still not being launched. However, when I stop the script with Ctrl+C now both the X server and the container are properly closed.

The check during docker pull waits an increasing amount of time.

That's great. I didn't realize.

x11docker can show the host pid of container pid 1 with --showpid1. Maybe this pid appears in ps --windows. But I doubt it, probably it is the pid within docker alpine VM.

You are ok. It is not shown with ps --windows.

Drawback: VcXsrv is not terminated in WSL. On a TERM signal it disappears from WSL process list, but it continues to run on Windows. This is a bug in WSL: microsoft/WSL#1614

I have not tested WSL yet. I don't like exposing the docker daemon through a TCP port without any authentication at all. I'm willing to test it when I guess how to limit it to 127.0.0.1. But I don't know if that will work.

octave prints octave: unable to open X11 DISPLAY, but I am not sure why. The log shows that DISPLAY is set correctly and a valid cookie is created. If I run e.g. x11docker --xwin --exe xterm, it works.

x11docker --xwin --exe xterm works for me too. But octave is still not shown, as reported above.

Could you run further tests in Cygwin with --xwin as well as --vcxsrv? Additional options to try if startup fails are --no-auth to disable cookie authentication and --desktop to have a visible X server window.

But maybe it is not a real unix socket as it resides on a Windows filesystem in C:/cygwin64/tmp/.X11-unix. It may be a cygwin specific "windows socket" that only works with applications compiled for cygwin.dll.

That makes sense. In the home of the project they state:

Cygwin is not:

  • a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
  • a way to magically make native Windows apps aware of UNIX® functionality like signals, ptys, etc. Again, you need to build your apps from source if you want to take advantage of Cygwin functionality.

Also, see:

x11docker may have to connect to Xwin over TCP instead of using the socket. I've allowed TCP for --xwin now. Please try: ./x11docker --xwin --display=1234 --env DISPLAY=10.0.75.1:1234 simexp/octave octave

It works! x11docker_xwin_tcp.log

Can you please test whether $? contains a useful value?

It is ok, both in Cygwin and in MSYS:

$ docker inspect nonsensename >/dev/null 2>&1
$ echo $?
1
$ docker inspect simexp/octave >/dev/null 2>&1
$ echo $?
0

@eine eine changed the title Support docker-for-win: --vcxsrv, --xming, cygwin/x... Support docker-for-win: --vcxsrv, --xwin, --xming... Aug 2, 2018
@mviereck
Copy link
Owner

mviereck commented Aug 2, 2018

But this might be related to git and cygwin; not something that x11docker can handle.

Ok, now I understand better. Maybe I'll add a hint in README.md.

I've added a hint message if one specifies --xwin.

I'll try it again after we get it to work properly (because I need to uninstall the package in order to test it).

You don't need to test it, it is not critical.

Will the message be shown too if no option is specified?

If x11docker finds VcXsrv but not Xwin, it will silently use --vcxsrv without giving a hint for Xwin. If it finds neither, it will show a message to install Xwin or VcXsrv on Cygwin, or VcXsrv only on MSYS2 and WSL.
Maybe it is possible to run Xwin in /cygwin64 even in MSYS2, did not test it yet.

However, when I stop the script with Ctrl+C now both the X server and the container are properly closed.

Great!

I have not tested WSL yet. I don't like exposing the docker daemon through a TCP port without any authentication at all. I'm willing to test it when I guess how to limit it to 127.0.0.1. But I don't know if that will work.

Ok.
Some people run docker natively in WSL without docker-for-win at all: https://www.reddit.com/r/bashonubuntuonwindows/comments/8cvr27/docker_is_running_natively_on_wsl/
I've tried that with current Windows developer VM, but it failes. Seemes to need further development.

Can you please test whether $? contains a useful value?

It is ok, both in Cygwin and in MSYS:

Good, that helps a lot. I was not sure if docker.exe would return a useful value through all those layers.

It works! x11docker_xwin_tcp.log

Great! x11docker now sets DISPLAY in container to IP:DISPLAY automatically for --xwin.

@mviereck
Copy link
Owner

mviereck commented Aug 3, 2018

About docker in WSL:
I found an interesting comment in the HowTo you've linked above, you would only need to create a bash alias that translates command docker to /mnt/c/xyz/docker.exe. Maybe it even works ootb without an alias if docker is not installed in WSL and docker.exe is within PATH:

There is a simpler way. Install docker for windows, then WSL/Ubuntu and in your back profile create an alias for docker=path-to-docker.exe
In WSL you can execute windows commands. This way you are in the the Ubuntu Bash shell but executing the windows docker command. No mapping, no docker client install.

It seems to be unusable for interactive use with -it, but x11docker would not need that:

Yep, but the problem with that is the input streams are completely busted.
Try doing it and then running docker-compose.exe up in a project, and then hit CTRL+C.
Or, try running docker.exe with the -it flags.

Maybe this needs additional translation magic for line endings.

If this works, x11docker could automatically look for docker.exe if it runs in WSL.


Another comment explains how to set up docker in WSL using already existing docker-for-win TLS connection (without publishing an insecure TCP port). Looks a bit complicated at the first glance, but at least someone cared about a secure setup.

@eine
Copy link
Contributor Author

eine commented Aug 3, 2018

@mviereck since this issue is getting long (over 40 comments already) and it is starting to be uncomfortable to scroll up and down, what do you think about opening a new issue to focus on WSL? We can keep this open to work on the last bits with Cygwin/MSYS (i.e. running xwin from MSYS).

If you are ok with it, you can remove your last comment above and use it as the first one in the new issue; I will then remove this comment. If your are not, please mark this comment with a thumb down and I will remove it.

@mviereck
Copy link
Owner

mviereck commented Aug 3, 2018

Yes, you are right. I'll leave the comments here as they are, but we can continue in #70.
We can close this issue as the essential basics already work well.
Further fine tuning can be done in additional tickets, e.g. checking options like --gpu, --pulseaudio,--stdin.

i.e. running xwin from MSYS.

I gave it a first try and failed. We can open a new ticket, too.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants