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

Interactive shell #87

Closed
DBLouis opened this issue Nov 13, 2018 · 35 comments
Closed

Interactive shell #87

DBLouis opened this issue Nov 13, 2018 · 35 comments

Comments

@DBLouis
Copy link

DBLouis commented Nov 13, 2018

I want to use x11docker for the security features but without an X server, just a Bash shell like normal docker. I tried running it with --nothing --stdin --stdout --stderr, it kind of work but the bash prompt is not displayed. I can still run command and see their result.

@mviereck
Copy link
Owner

Thanks for the suggestion!

I have included a new option --interactive to open an interactive TTY. It still needs some checks and fine-tuning, but basically it works.

Don't use --stdin --stdout --stderr.
Without --nothing x11docker still runs an X server. You can run X applications from TTY if you like to.

@mviereck
Copy link
Owner

Release v5.3.3 includes options -i, --interactive and -t, --tty.
This allows to run x11docker with -ti similar todocker run -ti.

--tty replaces --nothing, just running no X server.
--stdout and --stderr are deprecated, they are shown always now.

Remaining issue:
--interactive works with init options --systemd, --runit, --openrc and --sysvinit, but the shell does not have job control and CTRL-C can behave different than expected.
Without these init options --interactive works quite well.

@eine
Copy link
Contributor

eine commented Jan 20, 2019

Is it possible to run x11docker -it my_image bash, as you would with docker run, and have an X server started, even though it is not used (yet)?

The context is hardware design with GHDL and GtkWave. Most of the time the command line is used, but once in a while you want to start GtkWave, which is a GUI app. ATM (v5.2.0 #102), I need to start a container with x11docker (so that the X server is set up), and then docker exec -it x11docker_container_name bash in a different terminal. E.g.:

# ./x11docker simexp/octave bash
x11docker note: Could not check whether x11docker is running over ssh.
  Please install pstree.

x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/
# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
c21745f8c1f6        simexp/octave       "env /bin/sh - /x11d…"   4 seconds ago       Up 3 seconds                            x11docker_X1000_5eb02b_simexp-octave

# winpty docker exec -it x11docker_X1000_5eb02b_simexp-octave bash
eine@c21745f8c1f6:/tmp$ octave
eine@c21745f8c1f6:/tmp$

@mviereck
Copy link
Owner

Is it possible to run x11docker -it my_image bash, as you would with docker run, and have an X server started, even though it is not used (yet)?

Yes, that is possible. Just run with -i, --interactive only, and you will get an interactive shell and an X server. The shell will have DISPLAY and XAUTHORITY for X access.
-t, --tty only suppresses the start of an X server and has no other purpose.

@eine
Copy link
Contributor

eine commented Jan 20, 2019

I tried it now that #102 is fixed. It almost works, but there is an issue with MSYS2. I did not try with Cygwin or WSL.

The issue is that, in order to use docker run/exec -it, the command must be prepended with winpty. So:

# docker run --rm -it alpine sh -c "echo HELLO"
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

# winpty docker run --rm -it alpine sh -c "echo HELLO"
HELLO
# ./x11docker -i simexp/octave bash
./x11docker: line 5240: systemctl: command not found
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'
ps: unknown option -- o
Try `ps --help' for more information.

@eine
Copy link
Contributor

eine commented Jan 20, 2019

I now tried it in WSL. I get the same result. However, winpty is not available (see #70 (comment)). I tried using the MSYS2 version from WSL, but it does not work:

~$ /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker.exe run --rm -it alpine sh -c "echo HELLO"
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

~$ /mnt/c/msys64/usr/bin/winpty.exe /mnt/c/Program\ Files/Docker/Docker/resources/bin/docker.exe run --rm -it alpine sh -c "echo HELLO"
/usr/bin/winpty: error: cannot start '/mnt/c/Program Files/Docker/Docker/resources/bin/docker.exe': No such file or directory

/mnt/c/Program Files/Docker/Docker/resources/bin$ /mnt/c/msys64/usr/bin/winpty.exe ./docker.exe run --rm -it alpine sh -c "echo HELLO"
stdin is not a tty

@mviereck mviereck reopened this Jan 20, 2019
@mviereck
Copy link
Owner

Does it work if you run winpty x11docker?

I could automatically add winpty to docker command if x11docker runs on MSYS2/Cygwin with -i. However, its an additional dependency, and it does not help for WSL.
Maybe x11docker could run docker.exe with cmd.exe. That may work for all of MSYS2/Cygwin/WSL.

Unfortunately I cannot test that in a Windows VM as docker does not run at all. I should ask for a development macbook where I can run Win10, too ;-).

@eine
Copy link
Contributor

eine commented Jan 20, 2019

Unfortunately, it does not:

# winpty ./x11docker -i simexp/octave bash
winpty: error: cannot start 'D:/data-dev/github/x11docker/x11docker -i simexp/octave bash': %1 is not a valid Win32 application. (error 0xc1)

# winpty /$(pwd)/x11docker -i simexp/octave bash
winpty: error: cannot start '//d/data-dev/github/x11docker/x11docker': No such file or directory

# winpty x11docker -i simexp/octave bash
winpty: error: cannot start 'x11docker': Not found in PATH

# export PATH=$PATH:$(pwd)

# x11docker
DEBUGNOTE[063.62]: Received SIGINT
DEBUGNOTE[063.72]: Terminating x11docker.
DEBUGNOTE[063.90]: List of stored background processes:

DEBUGNOTE[063.99]: time to say goodbye (finish)
DEBUGNOTE[064.15]: Exitcode 0

# winpty x11docker
winpty: error: cannot start 'x11docker': Not found in PATH

# winpty x11docker -i simexp/octave bash
winpty: error: cannot start 'x11docker': Not found in PATH

I could automatically add winpty to docker command if x11docker runs on MSYS2/Cygwin with -i. However, its an additional dependency, and it does not help for WSL.

I don't know if this is an option for Cygwin neither. I tried it today, and I get the same result as with WSL. However, even if winpty is not available as a Cygwin package, it can be downloaded from rprichard/winpty/releases. See rprichard/winpty#64 (comment).

Maybe x11docker could run docker.exe with cmd.exe. That may work for all of MSYS2/Cygwin/WSL.

It seems that winpty does not support neither bash nor MSYS2 path formats. I.e., it is a win32 app expecting a win32 app as an argument. I thinks that's why winpty x11docker cannot work. Should x11docker be a compiled app, it would work.

@eine
Copy link
Contributor

eine commented Jan 20, 2019

I found a workaround! After writing this:

Maybe x11docker could run docker.exe with cmd.exe. That may work for all of MSYS2/Cygwin/WSL.

It seems that winpty does not support neither bash nor MSYS2 path formats. I.e., it is a win32 app expecting a win32 app as an argument. I thinks that's why winpty x11docker cannot work. Should x11docker be a compiled app, it would work.

I realized that the following might work:

# winpty bash x11docker -i simexp/octave bash
x11docker: line 5240: systemctl: command not found
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

ps: unknown option -- o
Try `ps --help' for more information.
'/etc/skel/./.bash_logout' -> '/fakehome/eine/./.bash_logout'
'/etc/skel/./.bashrc' -> '/fakehome/eine/./.bashrc'
'/etc/skel/./.profile' -> '/fakehome/eine/./.profile'
eine@6c87195ff554:/home/octave$ octave
eine@6c87195ff554:/home/octave$ exit
exit

Eureka! So, at least, there is a workaround for MSYS2 which does not require any modification to x11docker. We should probably add a note to let users know that -i is not supported in Cygwin/WSL yet.

Unfortunately I cannot test that in a Windows VM as docker does not run at all. I should ask for a development macbook where I can run Win10, too ;-).

You might be able to install Win10 in a pendrive (not from a pendrive). I am not sure about how the license would work, though. You might use it without needing a key, although some options would be limited. Not ideal, but it might work.

@mviereck
Copy link
Owner

mviereck commented Jan 21, 2019

Eureka! So, at least, there is a workaround for MSYS2 which does not require any modification to x11docker. We should probably add a note to let users know that -i is not supported in Cygwin/WSL yet.

:-)
I've added a check for winpty and it is automatically added to docker command in --interactive mode now. A warning is shown if winpty is not found. Could you please try out? It should work in MSYS2 now even (or only?) without your workaround.

It is sad that Cygwin does not have a winpty package and needs compiling.
WSL is still in development and might provide a solution on its own in future.

You might be able to install Win10 in a pendrive (not from a pendrive). I am not sure about how the license would work, though.

I have an OEM win10 on a screwed out hard drive. Maybe I can somehow use it. It refuses to boot from USB and only works if being build into my laptop. But I don't like to exchange laptop hard drives for each test run of x11docker. (In Germany the EULA must not tie the licence to specific hardware, so I might be able to use it with a different machine.)

@eine
Copy link
Contributor

eine commented Jan 21, 2019

I've added a check for winpty and it is automatically added to docker command in --interactive mode now. A warning is shown if winpty is not found. Could you please try out? It should work in MSYS2 now even (or only?) without your workaround.

Great! Thanks.

There is some problem with the path that is shared with the container:

# ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: Mount denied:
The source path "C:/Users/eine/x11docker/cache/simexp-octave-b4f229/share;C"
doesn't exist and is not known to Docker.
See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.
# winpty bash ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: Mount denied:
The source path "C:/Users/eine/x11docker/cache/simexp-octave-031a78/share;C"
doesn't exist and is not known to Docker.
See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.
# ./x11docker simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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 ERROR: Got error message from docker daemon:
esourcein\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/c/Users/eine/x11docker/cache/simexp-octave-dd8ea1/share': mkdir /host_mnt/c: file exists.

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be: /c/Users/eine/x11docker/cache/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

./x11docker: line 441: /c/Users/eine/x11docker/cache/simexp-octave-dd8ea1/message.log: No such file or directory
./x11docker: line 441: /c/Users/eine/x11docker/cache/simexp-octave-dd8ea1/message.log: No such file or directory
./x11docker: line 441: /c/Users/eine/x11docker/cache/simexp-octave-dd8ea1/message.log: No such file or directory
./x11docker: line 441: /c/Users/eine/x11docker/cache/simexp-octave-dd8ea1/message.log: No such file or directory

Also, shouldn't this be unknown instead of unkown?

It refuses to boot from USB and only works if being build into my laptop. But I don't like to exchange laptop hard drives for each test run of x11docker.

That's a pitty. Changing the drives for each test is definitely not an option 😢.

@mviereck
Copy link
Owner

# ./x11docker -i simexp/octave bash
[...]
The source path "C:/Users/eine/x11docker/cache/simexp-octave-031a78/share;C"
doesn't exist and is not known to Docker.

The ;C is odd. Can you please run with --debug and show me the created docker command?


# ./x11docker simexp/octave bash
esourcein\docker.exe: Error response from daemon: error while creating mount source path '/host_mnt/c/Users/eine/x11docker/cache/simexp-octave-dd8ea1/share': mkdir /host_mnt/c: file exists.

That is annoying and seems to a docker issue. docker tries to create a folder that already exists and just should be shared. It can help to restart the docker daemon. If the issue persists, can you please run with --debug and show the created docker command, and also check whether the folder really exists?


Also, shouldn't this be unknown instead of unkown?

Yes, thanks.

@eine
Copy link
Contributor

eine commented Jan 21, 2019

The ;C is odd. Can you please run with --debug and show me the created docker command?

# ./x11docker --debug -i simexp/octave bash
DEBUGNOTE[764.82]: Command at Line 6693 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6830 - ::main::main
DEBUGNOTE[764.93]:
x11docker version: 5.3.4-beta
docker version:    Docker version 18.09.1, build 4c52b90
Host system:
Command:           ./x11docker '--debug' '-i' 'simexp/octave' 'bash'
Parsed options:     --debug -i -- 'simexp/octave' 'bash'
DEBUGNOTE[765.11]: Command at Line 5088 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6701 - ::check_host::main::main
DEBUGNOTE[771.34]: Dependency check for --vcxsrv: 0
DEBUGNOTE[771.87]: Dependency check for --vcxsrv: 0
DEBUGNOTE[772.37]: Dependency check for --vcxsrv: 0
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

DEBUGNOTE[773.64]: Stored background pid 12396 of watchpidlist
DEBUGNOTE[773.80]: Stored background pid 15212 of watchmessagefifo
./x11docker: line 2209: XDG_RUNTIME_DIR: unbound variable
DEBUGNOTE[774.24]: Command at Line 2211 returned with error code 1:
  xwininfo.exe -display :$Newdisplaynumber -root 2>&1
  6741 - ::check_newxenv::main::main
DEBUGNOTE[774.40]: New X environment:
  DISPLAY=10.0.75.1:100 XAUTHORITY=/c/Users/eine/x11docker/cache/simexp-octave-9eca3c/share/Xclientcookie XSOCKET=  X11DOCKER_CACHE=/c/Users/eine/x11docker/cache/simexp-octave-9eca3c
DEBUGNOTE[774.95]: X server command:
  /c/Program\ Files/VcXsrv/vcxsrv.exe :100 \
  -dpms -s off -retro \
  +extension RANDR +extension RENDER +extension GLX \
  +extension XVideo +extension DOUBLE-BUFFER \
  -extension X-Resource +extension SECURITY +extension DAMAGE \
  -extension XINERAMA -xinerama -extension MIT-SHM \
  -auth 'C:/Users/eine/x11docker/cache/simexp-octave-9eca3c/Xservercookie' \
  -listen tcp \
  -extension Composite -extension COMPOSITE \
  -extension XTEST -tst \
  -nowgl -iglx -lesspointer -multiwindow -noclipboard
DEBUGNOTE[775.24]: Users and terminal:
  x11docker was started by:                       eine
  As host user serves (running X, storing cache): eine
  Container user will be:                         eine
  Container user password:                        x11docker
  Getting permission to run docker with:          bash -c
  Running X and other user commands with:         bash -c
  Terminal for password frontend:                 bash -c
  Terminal to show docker pull progress:          bash -c
  Running on console:                             no
  Running over SSH:                               no
DEBUGNOTE[775.72]: Running on Windows subsystem: MSYS2
  Path to subsystem: C:/msys64/
  Mount path in subsystem: /
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/

DEBUGNOTE[776.52]: Generated docker command:
  docker.exe run --tty --rm --interactive \
  --name x11docker_X100_9eca3c_simexp-octave \
  --user 197609:197121 \
  --env USER=eine \
  --userns host \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/c/Users/eine/x11docker/cache/simexp-octave-9eca3c/share':'/x11docker':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xclientcookie' \
  --env 'DISPLAY=10.0.75.1:100' \
  -- simexp/octave /bin/sh - /x11docker/container.CMD.sh
DEBUGNOTE[776.79]: Command at Line 3870 returned with error code 1:
  grep -e '^DOCKER_'
  6779 - ::create_dockerrc::main::main
DEBUGNOTE[778.89]: Stored background pid 15204 of containershell
DEBUGNOTE[778.94]: Waiting for X server --vcxsrv to be ready.
DEBUGNOTE[779.19]: Stored background pid 14020 of Xserver
DEBUGNOTE[779.39]: Set pid 14020 on watchlist: Xserver
DEBUGNOTE[779.84]: Watching pids:
    14020       1    9316       8112  pty1      197609 21:16:19 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[780.92]: --vcxsrv is ready
DEBUGNOTE[782.31]: Running xinitrc
DEBUGNOTE[782.79]: Failed to retrieve trusted cookie from X server. Will bake one myself.
C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: Mount denied:
The source path "C:/Users/eine/x11docker/cache/simexp-octave-9eca3c/share;C"
doesn't exist and is not known to Docker.
See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.
DEBUGNOTE[783.35]: Created cookie: #ffff#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  8b5641ca6fcc520b89d4f3018a079bd7
#0006#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  8b5641ca6fcc520b89d4f3018a079bd7
DEBUGNOTE[783.79]: Running dockerrc
DEBUGNOTE[783.87]: Waiting for file creation of /c/Users/eine/x11docker/cache/simexp-octave-9eca3c/xtermready
DEBUGNOTE[784.22]: Container ID: x11docker_X100_9eca3c_simexp-octave
DEBUGNOTE[784.33]: Set pid CONTAINERx11docker_X100_9eca3c_simexp-octave on watchlist:
DEBUGNOTE[784.48]: Process tree of x11docker:
  ./x11docker: line 6821: pstree: command not found
DEBUGNOTE[784.64]: Container is up and running.
DEBUGNOTE[785.01]: Container IP:
DEBUGNOTE[785.39]: Host PID of container PID 1:
DEBUGNOTE[785.78]: Container PID: unkown
DEBUGNOTE[786.11]: Watching Container: x11docker_X100_9eca3c_simexp-octave
DEBUGNOTE[786.41]: watchpidlist: Container x11docker_X100_9eca3c_simexp-octave has terminated
DEBUGNOTE[786.52]: time to say goodbye (watchpidlist x11docker_X100_9eca3c_simexp-octave)
DEBUGNOTE[788.56]: time to say goodbye (main)
DEBUGNOTE[788.70]: time to say goodbye (watchpidlist)
DEBUGNOTE[788.73]: Terminating x11docker.
DEBUGNOTE[788.93]: List of stored background processes:
12396 watchpidlist
15212 watchmessagefifo
15204 containershell
14020 Xserver
DEBUGNOTE[789.22]: Checking: 14020 (Xserver):     14020       1    9316       8112  pty1      197609 21:16:19 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[789.40]: Terminating 14020 (Xserver) Xorg|Xephyr|Xvfb|Xwayland|nxagent|vcxsrv.exe|Xwin:     14020       1    9316       8112  pty1      197609 21:16:19 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[789.75]: Checking: 15204 (containershell):
DEBUGNOTE[790.04]: Checking: 15212 (watchmessagefifo):
DEBUGNOTE[790.32]: Checking: 12396 (watchpidlist):
DEBUGNOTE[790.45]: time to say goodbye (finish)
DEBUGNOTE[790.62]: Exitcode 0

That is annoying and seems to a docker issue. docker tries to create a folder that already exists and just should be shared. It can help to restart the docker daemon. If the issue persists, can you please run with --debug and show the created docker command, and also check whether the folder really exists?

# ./x11docker --debug simexp/octave bash
DEBUGNOTE[866.92]: Command at Line 6693 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6830 - ::main::main
DEBUGNOTE[867.04]:
x11docker version: 5.3.4-beta
docker version:    Docker version 18.09.1, build 4c52b90
Host system:
Command:           ./x11docker '--debug' 'simexp/octave' 'bash'
Parsed options:     --debug -- 'simexp/octave' 'bash'
DEBUGNOTE[867.21]: Command at Line 5088 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6701 - ::check_host::main::main
DEBUGNOTE[873.01]: Dependency check for --vcxsrv: 0
DEBUGNOTE[873.49]: Dependency check for --vcxsrv: 0
DEBUGNOTE[873.97]: Dependency check for --vcxsrv: 0
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

DEBUGNOTE[874.99]: Stored background pid 15852 of tailstdout
DEBUGNOTE[875.03]: Waiting for file content in /c/Users/eine/x11docker/cache/simexp-octave-6ae69b/container.pid1pid
DEBUGNOTE[875.19]: Stored background pid 6944 of tailstderr
DEBUGNOTE[875.57]: Stored background pid 5436 of watchpidlist
DEBUGNOTE[875.75]: Stored background pid 15356 of watchmessagefifo
./x11docker: line 2209: XDG_RUNTIME_DIR: unbound variable
DEBUGNOTE[876.19]: Command at Line 2211 returned with error code 1:
  xwininfo.exe -display :$Newdisplaynumber -root 2>&1
  6741 - ::check_newxenv::main::main
DEBUGNOTE[876.31]: New X environment:
  DISPLAY=10.0.75.1:100 XAUTHORITY=/c/Users/eine/x11docker/cache/simexp-octave-6ae69b/share/Xclientcookie XSOCKET=  X11DOCKER_CACHE=/c/Users/eine/x11docker/cache/simexp-octave-6ae69b
DEBUGNOTE[876.85]: X server command:
  /c/Program\ Files/VcXsrv/vcxsrv.exe :100 \
  -dpms -s off -retro \
  +extension RANDR +extension RENDER +extension GLX \
  +extension XVideo +extension DOUBLE-BUFFER \
  -extension X-Resource +extension SECURITY +extension DAMAGE \
  -extension XINERAMA -xinerama -extension MIT-SHM \
  -auth 'C:/Users/eine/x11docker/cache/simexp-octave-6ae69b/Xservercookie' \
  -listen tcp \
  -extension Composite -extension COMPOSITE \
  -extension XTEST -tst \
  -nowgl -iglx -lesspointer -multiwindow -noclipboard
DEBUGNOTE[877.16]: Users and terminal:
  x11docker was started by:                       eine
  As host user serves (running X, storing cache): eine
  Container user will be:                         eine
  Container user password:                        x11docker
  Getting permission to run docker with:          bash -c
  Running X and other user commands with:         bash -c
  Terminal for password frontend:                 bash -c
  Terminal to show docker pull progress:          mintty -e
  Running on console:                             no
  Running over SSH:                               no
DEBUGNOTE[877.65]: Running on Windows subsystem: MSYS2
  Path to subsystem: C:/msys64/
  Mount path in subsystem: /
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/

DEBUGNOTE[878.47]: Generated docker command:
  docker.exe run --tty --rm --detach \
  --name x11docker_X100_6ae69b_simexp-octave \
  --user 197609:197121 \
  --env USER=eine \
  --userns host \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/c/Users/eine/x11docker/cache/simexp-octave-6ae69b/share':'/x11docker':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xclientcookie' \
  --env 'DISPLAY=10.0.75.1:100' \
  -- simexp/octave /bin/sh - /x11docker/container.CMD.sh
DEBUGNOTE[878.72]: Command at Line 3870 returned with error code 1:
  grep -e '^DOCKER_'
  6779 - ::create_dockerrc::main::main
DEBUGNOTE[880.80]: Stored background pid 16216 of containershell
DEBUGNOTE[880.85]: Waiting for X server --vcxsrv to be ready.
DEBUGNOTE[881.11]: Stored background pid 14736 of Xserver
DEBUGNOTE[881.33]: Set pid 14736 on watchlist: Xserver
DEBUGNOTE[881.72]: Watching pids:
    14736       1    6748      14732  pty1      197609 21:18:00 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[882.88]: --vcxsrv is ready
DEBUGNOTE[884.28]: Running xinitrc
DEBUGNOTE[884.73]: Failed to retrieve trusted cookie from X server. Will bake one myself.
DEBUGNOTE[885.20]: Created cookie: #ffff#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  af6c4d5df5e6b9396b137b7d39fa4248
#0006#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  af6c4d5df5e6b9396b137b7d39fa4248
DEBUGNOTE[885.61]: Running dockerrc
DEBUGNOTE[886.07]: Command at Line 4940 returned with error code 1:
  $Passwordterminal "/usr/bin/env bash $Xtermrc"
  6814 - ::start_docker::main::main
DEBUGNOTE[886.13]: Container ID: 514d93353acdc559fb751bfd0f16576288fda8ff1dc2eeed1e2ef4e47df45c3e
DEBUGNOTE[886.24]: Waiting for file creation of /c/Users/eine/x11docker/cache/simexp-octave-6ae69b/xtermready
DEBUGNOTE[886.62]: Container is up and running.
DEBUGNOTE[886.74]: Set pid CONTAINER514d93353acdc559fb751bfd0f16576288fda8ff1dc2eeed1e2ef4e47df45c3e on watchlist:
DEBUGNOTE[886.89]: Process tree of x11docker:
  ./x11docker: line 6821: pstree: command not found

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/eine/x11docker/cache/simexp-octave-6ae69b/share': mkdir /host_mnt/c: file exists.

  Type 'x11docker --help' for usage information
  Debug options: '--verbose' (full log) or '--debug' (log excerpt).
  Logfile will be: /c/Users/eine/x11docker/cache/x11docker.log
  Please report issues at https://github.com/mviereck/x11docker

DEBUGNOTE[887.19]: Command at Line 409 returned with error code 1:
  return 1
  717 - ::error::watchmessagefifo::setup_fifo::main::main
DEBUGNOTE[887.29]: Terminating x11docker.
DEBUGNOTE[887.48]: List of stored background processes:
15852 tailstdout
6944 tailstderr
5436 watchpidlist
15356 watchmessagefifo
16216 containershell
14736 Xserver
DEBUGNOTE[887.58]: time to say goodbye (finish-subshell)
DEBUGNOTE[887.93]: Checking: 14736 (Xserver):     14736       1    6748      14732  pty1      197609 21:18:00 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[888.01]: time to say goodbye (watchpidlist)
DEBUGNOTE[888.18]: Terminating 14736 (Xserver) Xorg|Xephyr|Xvfb|Xwayland|nxagent|vcxsrv.exe|Xwin:     14736       1    6748      14732  pty1      197609 21:18:00 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[888.25]: Stopped waiting for file content of /c/Users/eine/x11docker/cache/simexp-octave-6ae69b/container.pid1pid due to terminating signal.
DEBUGNOTE[888.43]: Command at Line 477 returned with error code 1:
  return 1
  6727 - ::setup_verbosity::main::main
DEBUGNOTE[888.51]: time to say goodbye (main)
DEBUGNOTE[888.62]: Checking: 16216 (containershell):
DEBUGNOTE[888.69]: Terminating x11docker.
DEBUGNOTE[888.90]: List of stored background processes:
15852 tailstdout
6944 tailstderr
5436 watchpidlist
15356 watchmessagefifo
16216 containershell
14736 Xserver
DEBUGNOTE[888.96]: Checking: 15356 (watchmessagefifo):     15356    6748    6748      15356  pty1      197609 21:17:55 /usr/bin/bash
DEBUGNOTE[889.23]: Checking: 14736 (Xserver):
DEBUGNOTE[889.30]: Checking: 5436 (watchpidlist):
DEBUGNOTE[889.54]: Checking: 16216 (containershell):
DEBUGNOTE[889.61]: Checking: 6944 (tailstderr):      6944    6748    6748       6944  pty1      197609 21:17:55 /usr/bin/bash
DEBUGNOTE[889.88]: Checking: 15356 (watchmessagefifo):     15356    6748    6748      15356  pty1      197609 21:17:55 /usr/bin/bash
DEBUGNOTE[889.96]: Checking: 15852 (tailstdout):     15852    6748    6748      15852  pty1      197609 21:17:54 /usr/bin/bash
DEBUGNOTE[890.08]: Terminating 15356 (watchmessagefifo) x11docker:     15356    6748    6748      15356  pty1      197609 21:17:55 /usr/bin/bash
DEBUGNOTE[890.15]: time to say goodbye (finish)
DEBUGNOTE[890.33]: Command at Line 430 returned with error code 141:
  cut -c8-
  633 - ::verbose::saygoodbye::finish::error::watchmessagefifo::setup_fifo::main::main
DEBUGNOTE[890.48]: Checking: 5436 (watchpidlist):
DEBUGNOTE[890.77]: Checking: 6944 (tailstderr):      6944    6748    6748       6944  pty1      197609 21:17:55 /usr/bin/bash
DEBUGNOTE[891.08]: Checking: 15852 (tailstdout):     15852    6748    6748      15852  pty1      197609 21:17:54 /usr/bin/bash
DEBUGNOTE[891.23]: time to say goodbye (finish)
DEBUGNOTE[891.40]: Exitcode 1

However, surprisingly, this works:

# ./x11docker simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

DEBUGNOTE[059.26]: Received SIGINT
DEBUGNOTE[059.37]: Terminating x11docker.
DEBUGNOTE[059.55]: List of stored background processes:
9448 tailstdout
15936 tailstderr
10864 watchpidlist
16260 watchmessagefifo
15696 containershell
6964 Xserver
DEBUGNOTE[059.84]: Checking: 6964 (Xserver):
DEBUGNOTE[060.13]: Checking: 15696 (containershell):
DEBUGNOTE[060.44]: Checking: 16260 (watchmessagefifo):     16260   11952   11952      16260  pty1      197609 21:20:01 /usr/bin/bash
DEBUGNOTE[060.64]: Terminating 16260 (watchmessagefifo) x11docker:     16260   11952   11952      16260  pty1      197609 21:20:01 /usr/bin/bash
DEBUGNOTE[061.02]: Checking: 10864 (watchpidlist):     10864   11952   11952      10864  pty1      197609 21:20:01 /usr/bin/bash
DEBUGNOTE[061.21]: Terminating 10864 (watchpidlist) x11docker:     10864   11952   11952      10864  pty1      197609 21:20:01 /usr/bin/bash
DEBUGNOTE[061.58]: Checking: 15936 (tailstderr):
DEBUGNOTE[061.87]: Checking: 9448 (tailstdout):
DEBUGNOTE[062.01]: time to say goodbye (finish)
DEBUGNOTE[062.19]: Exitcode 0

./x11docker simexp/octave octave does also work as expected. So, it seems to be an issue when --debug and/or -i are used.

The folder does not exist.

@mviereck
Copy link
Owner

It is really strange. If the issue would occur only with -i, it would be probably something about winpty.
But these two commands are identical in setup:

# ./x11docker --debug simexp/octave bash
# ./x11docker simexp/octave bash

--debug only sets a strong bash error control and gives some output, but does not influence the setup of docker, X server or anything.

At least some others have the same issue: https://stackoverflow.com/questions/50817985/docker-tries-to-mkdir-the-folder-that-i-mount
Some solutions sound rather occult:

I got this error after changing my Windows password. I had to go into Docker settings and do "Reset credentials" under "Shared Drives", then restart Docker.


The folder does not exist.

My fault, it is deleted during termination of x11docker. But some debug lines indicate that it exists while x11docker is running.

I hope I'll have a good idea or find a hint in the web.

@mviereck
Copy link
Owner

Error response from daemon: error while creating mount source path: mkdir /host_mnt/c: file exists.

It is indeed a docker issue. Please look at #104.

@mviereck
Copy link
Owner

@1138-4eb If the docker bug workarounds in #104 do not help, but -i works for you without x11docker implementation of winpty, I could revert the change and drop winpty in x11docker.

The underlying bug should be resolved by the docker team, but they didn't even reply to the bug report since a year although it affects a lot of users. I admit, I am loosing some trust in docker-for-win.

@eine
Copy link
Contributor

eine commented Jan 22, 2019

I think that the mkdir problem was transitient. I restarted docker several times, and I also reset the credentials as suggested in #104. The problem I am having now is that ;C is appended to the path (see #87 (comment)):

./x11docker simexp/octave octave

Everything works as expected:

# ./x11docker simexp/octave octave
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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 simexp/octave bash

Everything works as expected.

# ./x11docker simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

DEBUGNOTE[099.63]: Received SIGINT
DEBUGNOTE[099.69]: Terminating x11docker.
DEBUGNOTE[099.81]: List of stored background processes:
11196 tailstdout
13212 tailstderr
16132 watchpidlist
13180 watchmessagefifo
10940 containershell
15560 Xserver
DEBUGNOTE[099.99]: Checking: 15560 (Xserver):
DEBUGNOTE[100.17]: Checking: 10940 (containershell):
DEBUGNOTE[100.34]: Checking: 13180 (watchmessagefifo):
DEBUGNOTE[100.52]: Checking: 16132 (watchpidlist):
DEBUGNOTE[100.70]: Checking: 13212 (tailstderr):
DEBUGNOTE[100.88]: Checking: 11196 (tailstdout):
DEBUGNOTE[100.95]: time to say goodbye (finish)
DEBUGNOTE[101.11]: Container still running. Executing 'docker stop'.
DEBUGNOTE[111.83]: Exitcode 0

However, I got this error once, when trying to run octave with docker exec:

# winpty docker exec -it x11docker_X100_007c56_simexp-octave octave
Invalid MIT-MAGIC-COOKIE-1 keyoctave: unable to open X11 DISPLAY
octave: disabling GUI features
Invalid MIT-MAGIC-COOKIE-1 keyGNU Octave, version 4.0.0
Copyright (C) 2015 John W. Eaton and others.
...
octave:1>

Closing and starting a new container fixed it.

./x11docker -i simexp/octave bash

The X server is started, but the container fails due to an invalid path. The X server is properly closed.

# ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: Mount denied:
The source path "C:/Users/eine/x11docker/cache/simexp-octave-50b81a/share;C"
doesn't exist and is not known to Docker.
See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.

./x11docker --debug simexp/octave octave

Everything works as expected:

# ./x11docker --debug simexp/octave octave
DEBUGNOTE[250.02]: Command at Line 6693 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6830 - ::main::main
DEBUGNOTE[250.09]:
x11docker version: 5.3.4-beta
docker version:    Docker version 18.09.1, build 4c52b90
Host system:
Command:           ./x11docker '--debug' 'simexp/octave' 'octave'
Parsed options:     --debug -- 'simexp/octave' 'octave'
DEBUGNOTE[250.19]: Command at Line 5088 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6701 - ::check_host::main::main
DEBUGNOTE[253.89]: Dependency check for --vcxsrv: 0
DEBUGNOTE[254.19]: Dependency check for --vcxsrv: 0
DEBUGNOTE[254.49]: Dependency check for --vcxsrv: 0
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

DEBUGNOTE[255.15]: Stored background pid 14184 of tailstdout
DEBUGNOTE[255.17]: Waiting for file content in /c/Users/eine/x11docker/cache/simexp-octave-e433f2/container.pid1pid
DEBUGNOTE[255.26]: Stored background pid 15508 of tailstderr
DEBUGNOTE[255.48]: Stored background pid 11204 of watchpidlist
DEBUGNOTE[255.59]: Stored background pid 15936 of watchmessagefifo
./x11docker: line 2209: XDG_RUNTIME_DIR: unbound variable
DEBUGNOTE[255.84]: Command at Line 2211 returned with error code 1:
  xwininfo.exe -display :$Newdisplaynumber -root 2>&1
  6741 - ::check_newxenv::main::main
DEBUGNOTE[255.91]: New X environment:
  DISPLAY=10.0.75.1:100 XAUTHORITY=/c/Users/eine/x11docker/cache/simexp-octave-e433f2/share/Xclientcookie XSOCKET=  X11DOCKER_CACHE=/c/Users/eine/x11docker/cache/simexp-octave-e433f2
DEBUGNOTE[256.24]: X server command:
  /c/Program\ Files/VcXsrv/vcxsrv.exe :100 \
  -dpms -s off -retro \
  +extension RANDR +extension RENDER +extension GLX \
  +extension XVideo +extension DOUBLE-BUFFER \
  -extension X-Resource +extension SECURITY +extension DAMAGE \
  -extension XINERAMA -xinerama -extension MIT-SHM \
  -auth 'C:/Users/eine/x11docker/cache/simexp-octave-e433f2/Xservercookie' \
  -listen tcp \
  -extension Composite -extension COMPOSITE \
  -extension XTEST -tst \
  -nowgl -iglx -lesspointer -multiwindow -noclipboard
DEBUGNOTE[256.40]: Users and terminal:
  x11docker was started by:                       eine
  As host user serves (running X, storing cache): eine
  Container user will be:                         eine
  Container user password:                        x11docker
  Getting permission to run docker with:          bash -c
  Running X and other user commands with:         bash -c
  Terminal for password frontend:                 bash -c
  Terminal to show docker pull progress:          mintty -e
  Running on console:                             no
  Running over SSH:                               no
DEBUGNOTE[256.71]: Running on Windows subsystem: MSYS2
  Path to subsystem: C:/msys64/
  Mount path in subsystem: /
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/

DEBUGNOTE[257.19]: Generated docker command:
  docker.exe run --tty --rm --detach \
  --name x11docker_X100_e433f2_simexp-octave \
  --user 197609:197121 \
  --env USER=eine \
  --userns host \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/c/Users/eine/x11docker/cache/simexp-octave-e433f2/share':'/x11docker':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xclientcookie' \
  --env 'DISPLAY=10.0.75.1:100' \
  -- simexp/octave /bin/sh - /x11docker/container.CMD.sh
DEBUGNOTE[257.34]: Command at Line 3870 returned with error code 1:
  grep -e '^DOCKER_'
  6779 - ::create_dockerrc::main::main
DEBUGNOTE[258.67]: Stored background pid 6924 of containershell
DEBUGNOTE[258.70]: Waiting for X server --vcxsrv to be ready.
DEBUGNOTE[258.86]: Stored background pid 13700 of Xserver
DEBUGNOTE[258.97]: Set pid 13700 on watchlist: Xserver
DEBUGNOTE[259.56]: Watching pids:
    13700       1    9152      11448  pty1      197609 13:14:18 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[259.84]: Running xinitrc
DEBUGNOTE[259.84]: --vcxsrv is ready
DEBUGNOTE[260.09]: Failed to retrieve trusted cookie from X server. Will bake one myself.
DEBUGNOTE[260.35]: Created cookie: #ffff#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  e4087035bc87384dfc7879a7f980b59c
#0006#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  e4087035bc87384dfc7879a7f980b59c
DEBUGNOTE[260.60]: Running dockerrc
DEBUGNOTE[262.21]: Waiting for file creation of /c/Users/eine/x11docker/cache/simexp-octave-e433f2/xtermready
DEBUGNOTE[262.49]: Set pid CONTAINERd8ee64ec406d64d67225054078899b78ea118ceeecabd2332e96851231c92531 on watchlist:
DEBUGNOTE[263.08]: Container ID: d8ee64ec406d64d67225054078899b78ea118ceeecabd2332e96851231c92531
DEBUGNOTE[263.31]: Container is up and running.
DEBUGNOTE[263.59]: Process tree of container:
./x11docker: line 4961: pstree: command not found
DEBUGNOTE[263.71]: Watching Container: d8ee64ec406d64d67225054078899b78ea118ceeecabd2332e96851231c92531
DEBUGNOTE[263.76]: Container IP: 172.17.0.2
DEBUGNOTE[263.75]: Process tree of x11docker:
  ./x11docker: line 6821: pstree: command not found
DEBUGNOTE[264.02]: Host PID of container PID 1: 6901
DEBUGNOTE[264.25]: Container PID: unknown
DEBUGNOTE[264.48]: Running setup as root in container
DEBUGNOTE[264.72]: Container libc: glibc
DEBUGNOTE[265.25]: Running unprivileged user commands in container
DEBUGNOTE[266.40]: Running image command: octave
DEBUGNOTE[270.21]: watchpidlist: Container d8ee64ec406d64d67225054078899b78ea118ceeecabd2332e96851231c92531 has terminated
DEBUGNOTE[270.27]: time to say goodbye (watchpidlist d8ee64ec406d64d67225054078899b78ea118ceeecabd2332e96851231c92531)
DEBUGNOTE[271.93]: time to say goodbye (main)
DEBUGNOTE[272.02]: Terminating x11docker.
DEBUGNOTE[272.13]: List of stored background processes:
14184 tailstdout
15508 tailstderr
11204 watchpidlist
15936 watchmessagefifo
6924 containershell
13700 Xserver
DEBUGNOTE[272.32]: Checking: 13700 (Xserver):     13700       1    9152      11448  pty1      197609 13:14:18 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[272.38]: time to say goodbye (watchpidlist)
DEBUGNOTE[272.45]: Terminating 13700 (Xserver) Xorg|Xephyr|Xvfb|Xwayland|nxagent|vcxsrv.exe|Xwin:     13700       1    9152      11448  pty1      197609 13:14:18 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[272.67]: Checking: 6924 (containershell):
DEBUGNOTE[272.84]: Checking: 15936 (watchmessagefifo):
DEBUGNOTE[273.02]: Checking: 11204 (watchpidlist):
DEBUGNOTE[273.20]: Checking: 15508 (tailstderr):     15508    9152    9152      15508  pty1      197609 13:14:15 /usr/bin/bash
DEBUGNOTE[273.39]: Checking: 14184 (tailstdout):     14184    9152    9152      14184  pty1      197609 13:14:15 /usr/bin/bash
DEBUGNOTE[273.48]: time to say goodbye (finish)
DEBUGNOTE[273.64]: Exitcode 0

./x11docker --debug simexp/octave bash

Everything works as expected. I can also docker exec from a different shell and GUI apps work.

# ./x11docker --debug simexp/octave bash
DEBUGNOTE[334.53]: Command at Line 6693 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6830 - ::main::main
DEBUGNOTE[334.61]:
x11docker version: 5.3.4-beta
docker version:    Docker version 18.09.1, build 4c52b90
Host system:
Command:           ./x11docker '--debug' 'simexp/octave' 'bash'
Parsed options:     --debug -- 'simexp/octave' 'bash'
DEBUGNOTE[334.71]: Command at Line 5088 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6701 - ::check_host::main::main
DEBUGNOTE[338.51]: Dependency check for --vcxsrv: 0
DEBUGNOTE[338.82]: Dependency check for --vcxsrv: 0
DEBUGNOTE[339.13]: Dependency check for --vcxsrv: 0
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

DEBUGNOTE[339.80]: Stored background pid 8956 of tailstdout
DEBUGNOTE[339.83]: Waiting for file content in /c/Users/eine/x11docker/cache/simexp-octave-6771fe/container.pid1pid
DEBUGNOTE[339.91]: Stored background pid 10560 of tailstderr
DEBUGNOTE[340.14]: Stored background pid 15408 of watchpidlist
DEBUGNOTE[340.24]: Stored background pid 15724 of watchmessagefifo
./x11docker: line 2209: XDG_RUNTIME_DIR: unbound variable
DEBUGNOTE[340.49]: Command at Line 2211 returned with error code 1:
  xwininfo.exe -display :$Newdisplaynumber -root 2>&1
  6741 - ::check_newxenv::main::main
DEBUGNOTE[340.55]: New X environment:
  DISPLAY=10.0.75.1:100 XAUTHORITY=/c/Users/eine/x11docker/cache/simexp-octave-6771fe/share/Xclientcookie XSOCKET=  X11DOCKER_CACHE=/c/Users/eine/x11docker/cache/simexp-octave-6771fe
DEBUGNOTE[340.89]: X server command:
  /c/Program\ Files/VcXsrv/vcxsrv.exe :100 \
  -dpms -s off -retro \
  +extension RANDR +extension RENDER +extension GLX \
  +extension XVideo +extension DOUBLE-BUFFER \
  -extension X-Resource +extension SECURITY +extension DAMAGE \
  -extension XINERAMA -xinerama -extension MIT-SHM \
  -auth 'C:/Users/eine/x11docker/cache/simexp-octave-6771fe/Xservercookie' \
  -listen tcp \
  -extension Composite -extension COMPOSITE \
  -extension XTEST -tst \
  -nowgl -iglx -lesspointer -multiwindow -noclipboard
DEBUGNOTE[341.06]: Users and terminal:
  x11docker was started by:                       eine
  As host user serves (running X, storing cache): eine
  Container user will be:                         eine
  Container user password:                        x11docker
  Getting permission to run docker with:          bash -c
  Running X and other user commands with:         bash -c
  Terminal for password frontend:                 bash -c
  Terminal to show docker pull progress:          mintty -e
  Running on console:                             no
  Running over SSH:                               no
DEBUGNOTE[341.34]: Running on Windows subsystem: MSYS2
  Path to subsystem: C:/msys64/
  Mount path in subsystem: /
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/

DEBUGNOTE[341.81]: Generated docker command:
  docker.exe run --tty --rm --detach \
  --name x11docker_X100_6771fe_simexp-octave \
  --user 197609:197121 \
  --env USER=eine \
  --userns host \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/c/Users/eine/x11docker/cache/simexp-octave-6771fe/share':'/x11docker':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xclientcookie' \
  --env 'DISPLAY=10.0.75.1:100' \
  -- simexp/octave /bin/sh - /x11docker/container.CMD.sh
DEBUGNOTE[341.97]: Command at Line 3870 returned with error code 1:
  grep -e '^DOCKER_'
  6779 - ::create_dockerrc::main::main
DEBUGNOTE[343.27]: Stored background pid 13360 of containershell
DEBUGNOTE[343.28]: Waiting for X server --vcxsrv to be ready.
DEBUGNOTE[343.43]: Stored background pid 11800 of Xserver
DEBUGNOTE[343.57]: Set pid 11800 on watchlist: Xserver
DEBUGNOTE[344.21]: Watching pids:
    11800       1   16160        288  pty1      197609 13:15:43 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[344.41]: --vcxsrv is ready
DEBUGNOTE[344.50]: Running xinitrc
DEBUGNOTE[344.75]: Failed to retrieve trusted cookie from X server. Will bake one myself.
DEBUGNOTE[345.01]: Created cookie: #ffff#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  ebf3c5cb3751914a26a3d46c9e2786f1
#0006#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  ebf3c5cb3751914a26a3d46c9e2786f1
DEBUGNOTE[345.27]: Running dockerrc
DEBUGNOTE[346.89]: Waiting for file creation of /c/Users/eine/x11docker/cache/simexp-octave-6771fe/xtermready
DEBUGNOTE[347.13]: Set pid CONTAINER551a8d80c56b80e11f0a7e3268b384f6ae8d51473d02342d0ec9d5c7bd8d484a on watchlist:
DEBUGNOTE[347.73]: Container ID: 551a8d80c56b80e11f0a7e3268b384f6ae8d51473d02342d0ec9d5c7bd8d484a
DEBUGNOTE[347.97]: Container is up and running.
DEBUGNOTE[348.22]: Process tree of container:
./x11docker: line 4961: pstree: command not found
DEBUGNOTE[348.36]: Process tree of x11docker:
  ./x11docker: line 6821: pstree: command not found
DEBUGNOTE[348.36]: Watching Container: 551a8d80c56b80e11f0a7e3268b384f6ae8d51473d02342d0ec9d5c7bd8d484a
DEBUGNOTE[348.39]: Container IP: 172.17.0.2
DEBUGNOTE[348.64]: Host PID of container PID 1: 7299
DEBUGNOTE[348.86]: Container PID: unknown
DEBUGNOTE[349.09]: Running setup as root in container
DEBUGNOTE[349.33]: Container libc: glibc
DEBUGNOTE[349.85]: Running unprivileged user commands in container
DEBUGNOTE[351.01]: Running image command: bash
DEBUGNOTE[410.10]: Received SIGINT
DEBUGNOTE[410.18]: Terminating x11docker.
DEBUGNOTE[410.29]: List of stored background processes:
8956 tailstdout
10560 tailstderr
15408 watchpidlist
15724 watchmessagefifo
13360 containershell
11800 Xserver
DEBUGNOTE[410.46]: Checking: 11800 (Xserver):
DEBUGNOTE[410.64]: Checking: 13360 (containershell):
DEBUGNOTE[410.82]: Checking: 15724 (watchmessagefifo):
DEBUGNOTE[411.00]: Checking: 15408 (watchpidlist):
DEBUGNOTE[411.19]: Checking: 10560 (tailstderr):
DEBUGNOTE[411.37]: Checking: 8956 (tailstdout):
DEBUGNOTE[411.45]: time to say goodbye (finish)
DEBUGNOTE[411.62]: Container still running. Executing 'docker stop'.
DEBUGNOTE[422.41]: Exitcode 0
# winpty docker exec -it x11docker_X100_6771fe_simexp-octave octave

./x11docker --debug -i simexp/octave bash

Same path error as without --debug:

# ./x11docker --debug -i simexp/octave bash
DEBUGNOTE[552.17]: Command at Line 6693 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6830 - ::main::main
DEBUGNOTE[552.24]:
x11docker version: 5.3.4-beta
docker version:    Docker version 18.09.1, build 4c52b90
Host system:
Command:           ./x11docker '--debug' '-i' 'simexp/octave' 'bash'
Parsed options:     --debug -i -- 'simexp/octave' 'bash'
DEBUGNOTE[552.35]: Command at Line 5088 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6701 - ::check_host::main::main
DEBUGNOTE[556.06]: Dependency check for --vcxsrv: 0
DEBUGNOTE[556.37]: Dependency check for --vcxsrv: 0
DEBUGNOTE[556.68]: Dependency check for --vcxsrv: 0
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

DEBUGNOTE[557.49]: Stored background pid 14012 of watchpidlist
DEBUGNOTE[557.59]: Stored background pid 8456 of watchmessagefifo
./x11docker: line 2209: XDG_RUNTIME_DIR: unbound variable
DEBUGNOTE[557.83]: Command at Line 2211 returned with error code 1:
  xwininfo.exe -display :$Newdisplaynumber -root 2>&1
  6741 - ::check_newxenv::main::main
DEBUGNOTE[557.90]: New X environment:
  DISPLAY=10.0.75.1:100 XAUTHORITY=/c/Users/eine/x11docker/cache/simexp-octave-c7e870/share/Xclientcookie XSOCKET=  X11DOCKER_CACHE=/c/Users/eine/x11docker/cache/simexp-octave-c7e870
DEBUGNOTE[558.23]: X server command:
  /c/Program\ Files/VcXsrv/vcxsrv.exe :100 \
  -dpms -s off -retro \
  +extension RANDR +extension RENDER +extension GLX \
  +extension XVideo +extension DOUBLE-BUFFER \
  -extension X-Resource +extension SECURITY +extension DAMAGE \
  -extension XINERAMA -xinerama -extension MIT-SHM \
  -auth 'C:/Users/eine/x11docker/cache/simexp-octave-c7e870/Xservercookie' \
  -listen tcp \
  -extension Composite -extension COMPOSITE \
  -extension XTEST -tst \
  -nowgl -iglx -lesspointer -multiwindow -noclipboard
DEBUGNOTE[558.40]: Users and terminal:
  x11docker was started by:                       eine
  As host user serves (running X, storing cache): eine
  Container user will be:                         eine
  Container user password:                        x11docker
  Getting permission to run docker with:          bash -c
  Running X and other user commands with:         bash -c
  Terminal for password frontend:                 bash -c
  Terminal to show docker pull progress:          bash -c
  Running on console:                             no
  Running over SSH:                               no
DEBUGNOTE[558.68]: Running on Windows subsystem: MSYS2
  Path to subsystem: C:/msys64/
  Mount path in subsystem: /
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/

DEBUGNOTE[559.18]: Generated docker command:
  docker.exe run --tty --rm --interactive \
  --name x11docker_X100_c7e870_simexp-octave \
  --user 197609:197121 \
  --env USER=eine \
  --userns host \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/c/Users/eine/x11docker/cache/simexp-octave-c7e870/share':'/x11docker':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xclientcookie' \
  --env 'DISPLAY=10.0.75.1:100' \
  -- simexp/octave /bin/sh - /x11docker/container.CMD.sh
DEBUGNOTE[559.32]: Command at Line 3870 returned with error code 1:
  grep -e '^DOCKER_'
  6779 - ::create_dockerrc::main::main
DEBUGNOTE[560.67]: Stored background pid 11396 of containershell
DEBUGNOTE[560.71]: Waiting for X server --vcxsrv to be ready.
DEBUGNOTE[560.86]: Stored background pid 15040 of Xserver
DEBUGNOTE[560.97]: Set pid 15040 on watchlist: Xserver
DEBUGNOTE[561.57]: Watching pids:
    15040       1   11488       9812  pty1      197609 13:19:20 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[561.82]: --vcxsrv is ready
DEBUGNOTE[561.83]: Running xinitrc
DEBUGNOTE[562.08]: Failed to retrieve trusted cookie from X server. Will bake one myself.
DEBUGNOTE[562.34]: Created cookie: #ffff#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  7b68b2cafe63a569e4efba46bd964d21
#0006#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  7b68b2cafe63a569e4efba46bd964d21
DEBUGNOTE[562.59]: Running dockerrc
C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: Mount denied:
The source path "C:/Users/eine/x11docker/cache/simexp-octave-c7e870/share;C"
doesn't exist and is not known to Docker.
See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.
DEBUGNOTE[563.35]: Waiting for file creation of /c/Users/eine/x11docker/cache/simexp-octave-c7e870/xtermready
DEBUGNOTE[563.59]: Set pid CONTAINERx11docker_X100_c7e870_simexp-octave on watchlist:
DEBUGNOTE[563.67]: Process tree of x11docker:
  ./x11docker: line 6821: pstree: command not found
DEBUGNOTE[563.70]: Watching Container: x11docker_X100_c7e870_simexp-octave
DEBUGNOTE[563.87]: watchpidlist: Container x11docker_X100_c7e870_simexp-octave has terminated
DEBUGNOTE[563.93]: time to say goodbye (watchpidlist x11docker_X100_c7e870_simexp-octave)
DEBUGNOTE[565.81]: time to say goodbye (main)
DEBUGNOTE[565.90]: Terminating x11docker.
DEBUGNOTE[566.02]: List of stored background processes:
14012 watchpidlist
8456 watchmessagefifo
11396 containershell
15040 Xserver
DEBUGNOTE[566.03]: time to say goodbye (watchpidlist)
DEBUGNOTE[566.21]: Checking: 15040 (Xserver):     15040       1   11488       9812  pty1      197609 13:19:20 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[566.32]: Terminating 15040 (Xserver) Xorg|Xephyr|Xvfb|Xwayland|nxagent|vcxsrv.exe|Xwin:     15040       1   11488       9812  pty1      197609 13:19:20 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[566.54]: Checking: 11396 (containershell):
DEBUGNOTE[566.71]: Checking: 8456 (watchmessagefifo):
DEBUGNOTE[566.89]: Checking: 14012 (watchpidlist):
DEBUGNOTE[566.97]: time to say goodbye (finish)
DEBUGNOTE[567.13]: Exitcode 0

winpty bash ./x11docker simexp/octave octave

Everything works as expected:

# winpty bash ./x11docker simexp/octave octave
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

winpty bash ./x11docker simexp/octave bash

Everything works as expected.

winpty bash ./x11docker -i simexp/octave bash

Same path error as without winpty bash:

# winpty bash ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: Mount denied:
The source path "C:/Users/eine/x11docker/cache/simexp-octave-403611/share;C"
doesn't exist and is not known to Docker.
See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.

winpty bash ./x11docker --debug -i simexp/octave bash

Same path error as without winpty bash:

# winpty bash ./x11docker --debug -i simexp/octave bash
DEBUGNOTE[043.18]: Command at Line 6693 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6830 - ::main::main
DEBUGNOTE[043.25]:
x11docker version: 5.3.4-beta
docker version:    Docker version 18.09.1, build 4c52b90
Host system:
Command:           ./x11docker '--debug' '-i' 'simexp/octave' 'bash'
Parsed options:     --debug -i -- 'simexp/octave' 'bash'
DEBUGNOTE[043.36]: Command at Line 5088 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6701 - ::check_host::main::main
DEBUGNOTE[047.03]: Dependency check for --vcxsrv: 0
DEBUGNOTE[047.34]: Dependency check for --vcxsrv: 0
DEBUGNOTE[047.65]: Dependency check for --vcxsrv: 0
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

DEBUGNOTE[048.42]: Stored background pid 1008 of watchpidlist
DEBUGNOTE[048.52]: Stored background pid 10952 of watchmessagefifo
./x11docker: line 2209: XDG_RUNTIME_DIR: unbound variable
DEBUGNOTE[048.77]: Command at Line 2211 returned with error code 1:
  xwininfo.exe -display :$Newdisplaynumber -root 2>&1
  6741 - ::check_newxenv::main::main
DEBUGNOTE[048.84]: New X environment:
  DISPLAY=10.0.75.1:100 XAUTHORITY=/c/Users/eine/x11docker/cache/simexp-octave-06396c/share/Xclientcookie XSOCKET=  X11DOCKER_CACHE=/c
/Users/eine/x11docker/cache/simexp-octave-06396c
DEBUGNOTE[049.17]: X server command:
  /c/Program\ Files/VcXsrv/vcxsrv.exe :100 \
  -dpms -s off -retro \
  +extension RANDR +extension RENDER +extension GLX \
  +extension XVideo +extension DOUBLE-BUFFER \
  -extension X-Resource +extension SECURITY +extension DAMAGE \
  -extension XINERAMA -xinerama -extension MIT-SHM \
  -auth 'C:/Users/eine/x11docker/cache/simexp-octave-06396c/Xservercookie' \
  -listen tcp \
  -extension Composite -extension COMPOSITE \
  -extension XTEST -tst \
  -nowgl -iglx -lesspointer -multiwindow -noclipboard
DEBUGNOTE[049.34]: Users and terminal:
  x11docker was started by:                       eine
  As host user serves (running X, storing cache): eine
  Container user will be:                         eine
  Container user password:                        x11docker
  Getting permission to run docker with:          bash -c
  Running X and other user commands with:         bash -c
  Terminal for password frontend:                 bash -c
  Terminal to show docker pull progress:          bash -c
  Running on console:                             no
  Running over SSH:                               no
DEBUGNOTE[049.63]: Running on Windows subsystem: MSYS2
  Path to subsystem: C:/msys64/
  Mount path in subsystem: /
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/

DEBUGNOTE[050.10]: Generated docker command:
  docker.exe run --tty --rm --interactive \
  --name x11docker_X100_06396c_simexp-octave \
  --user 197609:197121 \
  --env USER=eine \
  --userns host \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/c/Users/eine/x11docker/cache/simexp-octave-06396c/share':'/x11docker':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xclientcookie' \
  --env 'DISPLAY=10.0.75.1:100' \
  -- simexp/octave /bin/sh - /x11docker/container.CMD.sh
DEBUGNOTE[050.26]: Command at Line 3870 returned with error code 1:
  grep -e '^DOCKER_'
  6779 - ::create_dockerrc::main::main
DEBUGNOTE[051.58]: Stored background pid 4760 of containershell
DEBUGNOTE[051.62]: Waiting for X server --vcxsrv to be ready.
DEBUGNOTE[051.75]: Stored background pid 13196 of Xserver
DEBUGNOTE[051.86]: Set pid 13196 on watchlist: Xserver
DEBUGNOTE[052.49]: Watching pids:
    13196       1   15892      12520  cons0     197609 13:27:31 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[052.71]: --vcxsrv is ready
DEBUGNOTE[052.76]: Running xinitrc
DEBUGNOTE[053.01]: Failed to retrieve trusted cookie from X server. Will bake one myself.
DEBUGNOTE[053.27]: Created cookie: #ffff#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  e1f75fa8528d79cc291f82617237e3a6
#0006#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  e1f75fa8528d79cc291f82617237e3a6
DEBUGNOTE[053.53]: Running dockerrc
C:/Program Files/Docker/Docker/resources/bin/docker.exe: Error response from daemon: Mount denied:
The source path "C:/Users/eine/x11docker/cache/simexp-octave-06396c/share;C"
doesn't exist and is not known to Docker.
See 'C:/Program Files/Docker/Docker/resources/bin/docker.exe run --help'.
DEBUGNOTE[054.24]: Waiting for file creation of /c/Users/eine/x11docker/cache/simexp-octave-06396c/xtermready
DEBUGNOTE[054.49]: Set pid CONTAINERx11docker_X100_06396c_simexp-octave on watchlist:
DEBUGNOTE[054.56]: Process tree of x11docker:
  ./x11docker: line 6821: pstree: command not found
DEBUGNOTE[054.61]: Watching Container: x11docker_X100_06396c_simexp-octave
DEBUGNOTE[054.79]: watchpidlist: Container x11docker_X100_06396c_simexp-octave has terminated
DEBUGNOTE[054.84]: time to say goodbye (watchpidlist x11docker_X100_06396c_simexp-octave)
DEBUGNOTE[056.66]: time to say goodbye (main)
DEBUGNOTE[056.76]: Terminating x11docker.
DEBUGNOTE[056.87]: List of stored background processes:
1008 watchpidlist
10952 watchmessagefifo
4760 containershell
13196 Xserver
DEBUGNOTE[056.95]: time to say goodbye (watchpidlist)
DEBUGNOTE[057.08]: Checking: 13196 (Xserver):     13196       1   15892      12520  cons0     197609 13:27:31 /c/Program Files/VcXsrv/
vcxsrv
DEBUGNOTE[057.19]: Terminating 13196 (Xserver) Xorg|Xephyr|Xvfb|Xwayland|nxagent|vcxsrv.exe|Xwin:     13196       1   15892      12520
  cons0     197609 13:27:31 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[057.42]: Checking: 4760 (containershell):
DEBUGNOTE[057.60]: Checking: 10952 (watchmessagefifo):
DEBUGNOTE[057.77]: Checking: 1008 (watchpidlist):
DEBUGNOTE[057.85]: time to say goodbye (finish)
DEBUGNOTE[058.03]: Exitcode 0

@eine
Copy link
Contributor

eine commented Jan 22, 2019

I repeated some of the tests above with commit b42b364, instead of master:

./x11docker -i simexp/octave bash

Error because winpty is not used, as expected.

# ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

./x11docker --debug -i simexp/octave bash

Error because winpty is not used, as expected.

# ./x11docker --debug -i simexp/octave bash
DEBUGNOTE[469.91]: Command at Line 6686 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6823 - ::main::main
DEBUGNOTE[470.01]:
x11docker version: 5.3.4-beta
docker version:    Docker version 18.09.1, build 4c52b90
Host system:
Command:           ./x11docker '--debug' '-i' 'simexp/octave' 'bash'
Parsed options:     --debug -i -- 'simexp/octave' 'bash'
DEBUGNOTE[470.18]: Command at Line 5082 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6694 - ::check_host::main::main
DEBUGNOTE[475.60]: Dependency check for --vcxsrv: 0
DEBUGNOTE[476.07]: Dependency check for --vcxsrv: 0
DEBUGNOTE[476.54]: Dependency check for --vcxsrv: 0
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

DEBUGNOTE[477.72]: Stored background pid 9536 of watchpidlist
DEBUGNOTE[477.88]: Stored background pid 2844 of watchmessagefifo
./x11docker: line 2209: XDG_RUNTIME_DIR: unbound variable
DEBUGNOTE[478.26]: Command at Line 2211 returned with error code 1:
  xwininfo.exe -display :$Newdisplaynumber -root 2>&1
  6734 - ::check_newxenv::main::main
DEBUGNOTE[478.37]: New X environment:
  DISPLAY=10.0.75.1:100 XAUTHORITY=/c/Users/eine/x11docker/cache/simexp-octave-8b3b9f/share/Xclientcookie XSOCKET=  X11DOCKER_CACHE=/c/Users/eine/x11docker/cache/simexp-octave-8b3b9f
DEBUGNOTE[478.88]: X server command:
  /c/Program\ Files/VcXsrv/vcxsrv.exe :100 \
  -dpms -s off -retro \
  +extension RANDR +extension RENDER +extension GLX \
  +extension XVideo +extension DOUBLE-BUFFER \
  -extension X-Resource +extension SECURITY +extension DAMAGE \
  -extension XINERAMA -xinerama -extension MIT-SHM \
  -auth 'C:/Users/eine/x11docker/cache/simexp-octave-8b3b9f/Xservercookie' \
  -listen tcp \
  -extension Composite -extension COMPOSITE \
  -extension XTEST -tst \
  -nowgl -iglx -lesspointer -multiwindow -noclipboard
DEBUGNOTE[479.17]: Users and terminal:
  x11docker was started by:                       eine
  As host user serves (running X, storing cache): eine
  Container user will be:                         eine
  Container user password:                        x11docker
  Getting permission to run docker with:          bash -c
  Running X and other user commands with:         bash -c
  Terminal for password frontend:                 bash -c
  Terminal to show docker pull progress:          bash -c
  Running on console:                             no
  Running over SSH:                               no
DEBUGNOTE[479.62]: Running on Windows subsystem: MSYS2
  Path to subsystem: C:/msys64/
  Mount path in subsystem: /
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/

DEBUGNOTE[480.36]: Generated docker command:
  docker.exe run --tty --rm --interactive \
  --name x11docker_X100_8b3b9f_simexp-octave \
  --user 197609:197121 \
  --env USER=eine \
  --userns host \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/c/Users/eine/x11docker/cache/simexp-octave-8b3b9f/share':'/x11docker':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xclientcookie' \
  --env 'DISPLAY=10.0.75.1:100' \
  -- simexp/octave /bin/sh - /x11docker/container.CMD.sh
DEBUGNOTE[480.61]: Command at Line 3870 returned with error code 1:
  grep -e '^DOCKER_'
  6772 - ::create_dockerrc::main::main
DEBUGNOTE[482.59]: Stored background pid 11960 of containershell
DEBUGNOTE[482.63]: Waiting for X server --vcxsrv to be ready.
DEBUGNOTE[482.82]: Stored background pid 11120 of Xserver
DEBUGNOTE[482.98]: Set pid 11120 on watchlist: Xserver
DEBUGNOTE[483.85]: Watching pids:
    11120       1    2800       9248  pty1      197609 13:34:42 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[484.23]: Running xinitrc
DEBUGNOTE[484.48]: --vcxsrv is ready
DEBUGNOTE[484.61]: Failed to retrieve trusted cookie from X server. Will bake one myself.
DEBUGNOTE[484.99]: Created cookie: #ffff#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  25ee90be2fd37486d5120b5710cf916d
#0006#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  25ee90be2fd37486d5120b5710cf916d
DEBUGNOTE[485.36]: Running dockerrc
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'
DEBUGNOTE[486.86]: Waiting for file creation of /c/Users/eine/x11docker/cache/simexp-octave-8b3b9f/xtermready
DEBUGNOTE[487.23]: Set pid CONTAINERx11docker_X100_8b3b9f_simexp-octave on watchlist:
DEBUGNOTE[487.36]: Process tree of x11docker:
  ./x11docker: line 6814: pstree: command not found
DEBUGNOTE[487.77]: Container ID: x11docker_X100_8b3b9f_simexp-octave
DEBUGNOTE[488.05]: Watching Container: x11docker_X100_8b3b9f_simexp-octave
DEBUGNOTE[488.14]: Container is up and running.
DEBUGNOTE[488.33]: watchpidlist: Container x11docker_X100_8b3b9f_simexp-octave has terminated
DEBUGNOTE[488.44]: time to say goodbye (watchpidlist x11docker_X100_8b3b9f_simexp-octave)
DEBUGNOTE[488.53]: Container IP:
DEBUGNOTE[490.02]: time to say goodbye (main)
DEBUGNOTE[490.16]: Terminating x11docker.
DEBUGNOTE[490.34]: List of stored background processes:
9536 watchpidlist
2844 watchmessagefifo
11960 containershell
11120 Xserver
DEBUGNOTE[490.61]: time to say goodbye (watchpidlist)
DEBUGNOTE[490.63]: Checking: 11120 (Xserver):     11120       1    2800       9248  pty1      197609 13:34:42 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[490.79]: Terminating 11120 (Xserver) Xorg|Xephyr|Xvfb|Xwayland|nxagent|vcxsrv.exe|Xwin:     11120       1    2800       9248  pty1      197609 13:34:42 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[491.13]: Checking: 11960 (containershell):
DEBUGNOTE[491.39]: Checking: 2844 (watchmessagefifo):
DEBUGNOTE[491.65]: Checking: 9536 (watchpidlist):
DEBUGNOTE[491.76]: time to say goodbye (finish)
DEBUGNOTE[491.94]: Exitcode 0

winpty bash ./x11docker -i simexp/octave bash

Everything works as expected:

# winpty bash ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

'/etc/skel/./.bash_logout' -> '/fakehome/eine/./.bash_logout'
'/etc/skel/./.bashrc' -> '/fakehome/eine/./.bashrc'
'/etc/skel/./.profile' -> '/fakehome/eine/./.profile'
eine@141226738fd5:/home/octave$ octave
eine@141226738fd5:/home/octave$ exit
exit

winpty bash ./x11docker --debug -i simexp/octave bash

Everything works as expected:

# winpty bash ./x11docker --debug -i simexp/octave bash
DEBUGNOTE[699.04]: Command at Line 6686 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6823 - ::main::main
DEBUGNOTE[699.16]:
x11docker version: 5.3.4-beta
docker version:    Docker version 18.09.1, build 4c52b90
Host system:
Command:           ./x11docker '--debug' '-i' 'simexp/octave' 'bash'
Parsed options:     --debug -i -- 'simexp/octave' 'bash'
DEBUGNOTE[699.33]: Command at Line 5082 returned with error code 1:
  source /etc/os-release 2> /dev/null
  6694 - ::check_host::main::main
DEBUGNOTE[704.54]: Dependency check for --vcxsrv: 0
DEBUGNOTE[705.01]: Dependency check for --vcxsrv: 0
DEBUGNOTE[705.48]: Dependency check for --vcxsrv: 0
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

DEBUGNOTE[706.66]: Stored background pid 11304 of watchpidlist
DEBUGNOTE[706.82]: Stored background pid 11988 of watchmessagefifo
./x11docker: line 2209: XDG_RUNTIME_DIR: unbound variable
DEBUGNOTE[707.21]: Command at Line 2211 returned with error code 1:
  xwininfo.exe -display :$Newdisplaynumber -root 2>&1
  6734 - ::check_newxenv::main::main
DEBUGNOTE[707.31]: New X environment:
  DISPLAY=10.0.75.1:100 XAUTHORITY=/c/Users/eine/x11docker/cache/simexp-octave-e332fe/share/Xclientcookie XSOCKET=  X11DOCKER_CACHE=/c
/Users/eine/x11docker/cache/simexp-octave-e332fe
DEBUGNOTE[707.82]: X server command:
  /c/Program\ Files/VcXsrv/vcxsrv.exe :100 \
  -dpms -s off -retro \
  +extension RANDR +extension RENDER +extension GLX \
  +extension XVideo +extension DOUBLE-BUFFER \
  -extension X-Resource +extension SECURITY +extension DAMAGE \
  -extension XINERAMA -xinerama -extension MIT-SHM \
  -auth 'C:/Users/eine/x11docker/cache/simexp-octave-e332fe/Xservercookie' \
  -listen tcp \
  -extension Composite -extension COMPOSITE \
  -extension XTEST -tst \
  -nowgl -iglx -lesspointer -multiwindow -noclipboard
DEBUGNOTE[708.11]: Users and terminal:
  x11docker was started by:                       eine
  As host user serves (running X, storing cache): eine
  Container user will be:                         eine
  Container user password:                        x11docker
  Getting permission to run docker with:          bash -c
  Running X and other user commands with:         bash -c
  Terminal for password frontend:                 bash -c
  Terminal to show docker pull progress:          bash -c
  Running on console:                             no
  Running over SSH:                               no
DEBUGNOTE[708.58]: Running on Windows subsystem: MSYS2
  Path to subsystem: C:/msys64/
  Mount path in subsystem: /
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/

DEBUGNOTE[709.34]: Generated docker command:
  docker.exe run --tty --rm --interactive \
  --name x11docker_X100_e332fe_simexp-octave \
  --user 197609:197121 \
  --env USER=eine \
  --userns host \
  --cap-drop ALL \
  --security-opt no-new-privileges \
  --security-opt label=type:container_runtime_t \
  --tmpfs /run --tmpfs /run/lock \
  --volume '/c/Users/eine/x11docker/cache/simexp-octave-e332fe/share':'/x11docker':rw \
  --workdir '/tmp' \
  --entrypoint env \
  --env 'container=docker' \
  --env 'XAUTHORITY=/x11docker/Xclientcookie' \
  --env 'DISPLAY=10.0.75.1:100' \
  -- simexp/octave /bin/sh - /x11docker/container.CMD.sh
DEBUGNOTE[709.58]: Command at Line 3870 returned with error code 1:
  grep -e '^DOCKER_'
  6772 - ::create_dockerrc::main::main
DEBUGNOTE[711.55]: Stored background pid 14492 of containershell
DEBUGNOTE[711.59]: Waiting for X server --vcxsrv to be ready.
DEBUGNOTE[711.79]: Stored background pid 15508 of Xserver
DEBUGNOTE[711.95]: Set pid 15508 on watchlist: Xserver
DEBUGNOTE[712.79]: Watching pids:
    15508       1    4432      16200  cons0     197609 13:38:31 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[713.17]: Running xinitrc
DEBUGNOTE[713.49]: --vcxsrv is ready
DEBUGNOTE[713.55]: Failed to retrieve trusted cookie from X server. Will bake one myself.
DEBUGNOTE[713.95]: Created cookie: #ffff#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  573564dadb3935a4564112b113d7c777
#0006#fe80000000000000a464f05ba69c7cff#:100  MIT-MAGIC-COOKIE-1  573564dadb3935a4564112b113d7c777
DEBUGNOTE[714.31]: Running dockerrc
DEBUGNOTE[716.32]: Waiting for file creation of /c/Users/eine/x11docker/cache/simexp-octave-e332fe/xtermready
'/etc/skel/./.bash_logout' -> '/fakehome/eine/./.bash_logout'
'/etc/skel/./.bashrc' -> '/fakehome/eine/./.bashrc'
'/etc/skel/./.profile' -> '/fakehome/eine/./.profile'
eine@390eb87a0c7d:/home/octave$ DEBUGNOTE[716.70]: Set pid CONTAINERx11docker_X100_e332fe_simexp-octave on watchlist:
DEBUGNOTE[716.73]: Container ID: x11docker_X100_e332fe_simexp-octave
DEBUGNOTE[717.00]: Watching Container: x11docker_X100_e332fe_simexp-octave
DEBUGNOTE[717.10]: Container is up and running.
DEBUGNOTE[717.69]: Container IP: 172.17.0.2
DEBUGNOTE[717.86]: Process tree of container:
./x11docker: line 4955: pstree: command not found
DEBUGNOTE[718.03]: Process tree of x11docker:
  ./x11docker: line 6814: pstree: command not found
DEBUGNOTE[718.06]: Host PID of container PID 1: 10554
DEBUGNOTE[718.63]: Container PID: unkown
DEBUGNOTE[718.99]: Running setup as root in container
DEBUGNOTE[719.37]: Container libc: glibc
DEBUGNOTE[720.17]: Running unprivileged user commands in container
DEBUGNOTE[721.94]: Running image command: bash
octave
eine@390eb87a0c7d:/home/octave$ exit
exit
DEBUGNOTE[764.45]: watchpidlist: Container x11docker_X100_e332fe_simexp-octave has terminated
DEBUGNOTE[764.54]: time to say goodbye (watchpidlist x11docker_X100_e332fe_simexp-octave)
DEBUGNOTE[765.80]: time to say goodbye (main)
DEBUGNOTE[765.95]: Terminating x11docker.
DEBUGNOTE[766.12]: List of stored background processes:
11304 watchpidlist
11988 watchmessagefifo
14492 containershell
15508 Xserver
DEBUGNOTE[766.40]: Checking: 15508 (Xserver):     15508       1    4432      16200  cons0     197609 13:38:31 /c/Program Files/VcXsrv/
vcxsrv
DEBUGNOTE[766.57]: Terminating 15508 (Xserver) Xorg|Xephyr|Xvfb|Xwayland|nxagent|vcxsrv.exe|Xwin:     15508       1    4432      16200
  cons0     197609 13:38:31 /c/Program Files/VcXsrv/vcxsrv
DEBUGNOTE[766.72]: time to say goodbye (watchpidlist)
DEBUGNOTE[766.91]: Checking: 14492 (containershell):
DEBUGNOTE[767.18]: Checking: 11988 (watchmessagefifo):
DEBUGNOTE[767.45]: Checking: 11304 (watchpidlist):
DEBUGNOTE[767.57]: time to say goodbye (finish)
DEBUGNOTE[767.74]: Exitcode 0

@eine
Copy link
Contributor

eine commented Jan 22, 2019

@1138-4eb If the docker bug workarounds in #104 do not help, but -i works for you without x11docker implementation of winpty, I could revert the change and drop winpty in x11docker.

It is ok for me if you want to drop winpty from x11docker, as it is a very specific fix: only for MSYS2 on Win10.

However, after the last tests, I think it is an implementation issue on our side, not a bug in docker-for-win. It seems that something is not being escaped properly and ;C is appended. Is it possible that, because arguments are passed to winpty and then winpty passes them to docker, something breaks in the way? In the previous implementation x11docker passed arguments to docker directly, so there was no intermediate filtre.

The underlying bug should be resolved by the docker team, but they didn't even reply to the bug report since a year although it affects a lot of users. I admit, I am loosing some trust in docker-for-win.

It seems that Microsoft prefers users to use docker with windows containers, and WSL for GNU/Linux apps. That's probably why these docker-for-win bugs related to GNU/Linux containers receive less attention.

@mviereck
Copy link
Owner

Thanks for extensive testing!
It is odd that --debug now causes no error, but ok.

It seems that something is not being escaped properly and ;C is appended. Is it possible that, because arguments are passed to winpty and then winpty passes them to docker, something breaks in the way? In the previous implementation x11docker passed arguments to docker directly, so there was no intermediate filtre.

That is probably true. However, the ;C could as well be a mistake only in error message of docker and not introduced by winpty.

It seems that Microsoft prefers users to use docker with windows containers, and WSL for GNU/Linux apps. That's probably why these docker-for-win bugs related to GNU/Linux containers receive less attention.

docker-for-win is a docker project, not a Microsoft project. And Microsoft itself points to docker-for-win if users ask for docker support in WSL. I don't have the impression that they work together.

It is ok for me if you want to drop winpty from x11docker, as it is a very specific fix: only for MSYS2 on Win10.

I'll remove it, the update comes in a few minutes.

@mviereck
Copy link
Owner

mviereck commented Jan 22, 2019

I think we can close this ticket for now.
You first solution with winpty bash x11docker -i [...] seems to be the best yet, and a message explaining this is shown if x11docker runs with -i on Windows.
If something comes up, feel free to reopen.

@eine
Copy link
Contributor

eine commented Jan 22, 2019

docker-for-win is a docker project, not a Microsoft project. And Microsoft itself points to docker-for-win if users ask for docker support in WSL. I don't have the impression that they work together.

docker-for-win is a docker project, but Microsoft has been doing his own research and contributing to moby:

Docker and Microsoft have a joint engineering relationship to deliver a consistent Docker experience for developers and operators.


I think we can close this ticket for now.
You first solution with winpty bash x11docker -i [...] seems to be the best yet, and a message explaining this is shown if x11docker runs with -i on Windows.
If something comes up, feel free to reopen.

Agree.

@mviereck
Copy link
Owner

Interesting links, thank you!

Just an idea:
You could change line 4891:

    *)              echo "$Passwordcommand \"${Sudo}bash $Dockerrc \"" ;;

to:

    *)              echo "winpty $Passwordcommand \"${Sudo}bash $Dockerrc \"" ;;

In that case it would be a sort of winpty bash dockerrc syntax. That might work without the annoying path error that occurs with winpty docker.
If that fails, please try

    *)              echo "$Passwordcommand \"winpty ${Sudo}bash $Dockerrc \"" ;;

If one of them works, I could add winpty automatically again if x11docker starts with -i on Windows.

@eine
Copy link
Contributor

eine commented Jan 23, 2019

I think that the line you mean is now https://github.com/mviereck/x11docker/blob/master/x11docker#L4819. I tried both alternatives, but none of them work 😭. None of them produce the path error, they just work as if -i was not used. Surprisingly, the commands you write while the container is running are executed just after exiting:

# ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

x11docker note: Option -i, --interactive: On MS Windows you need
  to run x11docker with:   winpty bash x11docker [...]
  MSYS2 provides it as a package. On Cygwin it can be compiled from source.
  WSL isn't supported yet.

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/

ls
DEBUGNOTE[086.35]: Received SIGINT
DEBUGNOTE[086.46]: Terminating x11docker.
DEBUGNOTE[086.64]: List of stored background processes:
10504 watchpidlist
14216 watchmessagefifo
5232 containershell
14428 Xserver
DEBUGNOTE[086.94]: Checking: 14428 (Xserver):
DEBUGNOTE[087.22]: Checking: 5232 (containershell):
DEBUGNOTE[087.50]: Checking: 14216 (watchmessagefifo):     14216   11200     208       2736  pty1      197609 03:21:27 /usr/bin/ps
DEBUGNOTE[087.79]: Checking: 10504 (watchpidlist):     10504     208     208      10504  pty1      197609 03:20:24 /usr/bin/bash
DEBUGNOTE[087.96]: Terminating 10504 (watchpidlist) x11docker:     10504     208     208      10504  pty1      197609 03:20:24 /usr/bin/bash
DEBUGNOTE[088.16]: time to say goodbye (finish)
DEBUGNOTE[088.44]: Container still running. Executing 'docker stop'.
DEBUGNOTE[089.27]: Exitcode 0

# ls
CHANGELOG.md  LICENSE.txt  paper.bib  paper.md  README.md  timetosaygoodbye.fifo  x11docker*  x11docker.png  x11docker-gui*

@mviereck
Copy link
Owner

mviereck commented Jan 23, 2019

None of them produce the path error, they just work as if -i was not used. Surprisingly, the commands you write while the container is running are executed just after exiting:

It seems that stdin is not forwarded properly. No process took your ls input until MSYS2-bash accepted it from stdin.
I don't know if it is possible at all to forward stdin through a winpty call.

Another attempt: replace line 4212:

      echo "$Dockercommand <&0 &"

with:

      echo "#! /bin/bash
$Dockercommand" > $Cachefolder/dockercommand
      echo "winpty bash $Cachefolder/dockercommand <&0 &"

If that fails, try:

      echo "#! /bin/bash
$Dockercommand <&0" > $Cachefolder/dockercommand
      echo "winpty bash $Cachefolder/dockercommand <&0 &"

@eine
Copy link
Contributor

eine commented Jan 24, 2019

It works!

# ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

x11docker note: Option -i, --interactive: On MS Windows you need
  to run x11docker with:   winpty bash x11docker [...]
  MSYS2 provides it as a package. On Cygwin it can be compiled from source.
  WSL isn't supported yet.

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/

'/etc/skel/./.bash_logout' -> '/fakehome/eine/./.bash_logout'
'/etc/skel/./.bashrc' -> '/fakehome/eine/./.bashrc'
'/etc/skel/./.profile' -> '/fakehome/eine/./.profile'
eine@a15723a4627b:/home/octave$ ls
control-3.0.0.tar.gz  general-2.0.0.tar.gz  image-2.4.1.tar.gz  io-2.4.1.tar.gz  signal-1.3.2.tar.gz  statistics-1.2.4.tar.gz
eine@a15723a4627b:/home/octave$ exit
exit

@mviereck
Copy link
Owner

It works!

Great! :-)
The latest update integrates winpty again. Please run a test. If it works, I'll push a new release soon.

@eine
Copy link
Contributor

eine commented Jan 24, 2019

I does not fail explicitly, but neither does it work as expected:

# ./x11docker -i simexp/octave bash
x11docker note: Using X server option --vcxsrv

x11docker note: Per default x11docker stores its cache files on drive C:.
  docker setup may not allow to share files from drive C:.
  If startup fails with an 'access denied' error,
  please either allow access to drive C: or specify a custom folder for cache
  storage with option '--cachebasedir D:/some/cache/folder'.
  Same issue can occur with option '--home'.
  Use option '--homebasedir D:/some/home/folder' in that case.

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/

eine@1ee65e81efef:/home/octave$ octave
^C
eine@1ee65e81efef:/home/octave$ ls
control-3.0.0.tar.gz  general-2.0.0.tar.gz  image-2.4.1.tar.gz  io-2.4.1.tar.gz  signal-1.3.2.tar.gz  statistics-1.2.4.tar.gz
eine@1ee65e81efef:/home/octave$ echo $DISPLAY
10.0.75.1:100
eine@1ee65e81efef:/home/octave$ exit
exit

As you see, the X server was properly started and I got a shell inside the container. However, when I executed octave nothing happened. I did print $DISPLAY, and it was not empty. Yet, when exiting the container, it was properly closed. So was the X server.

I did restart Docker and try it again multiple times.

@mviereck
Copy link
Owner

It looks like an issue with the X server. I am not sure yet what goes wrong.

Normally if an X application cannot connect to the X server it shows an error message and terminates. But octave does not fail, it just does not open a Window. So it seems the X server is accessable.

Can you please try with another X application? Is it possible that the octave window is just hidden behind another window? What happens if you add option --desktop to make sure an X window is present?

Maybe an update of VcXsrv helps, just in case.

@eine
Copy link
Contributor

eine commented Jan 24, 2019

It looks like an issue with the X server. I am not sure yet what goes wrong.

I does look so, because ./x11docker simexp/octave octave is not working now.

Normally if an X application cannot connect to the X server it shows an error message and terminates. But octave does not fail, it just does not open a Window. So it seems the X server is accessable.

Yes, the X server seems to be accesible. The icon is shown in the task bar. But it displays 0 clients.

Can you please try with another X application? Is it possible that the octave window is just hidden behind another window? What happens if you add option --desktop to make sure an X window is present?

I tried with ./x11docker x11docker/xfce xfce4-terminal. Same result.

With --desktop, the X desktop is shown, but no window is created inside. Neither with octave nor with xfce4-terminal.

Maybe an update of VcXsrv helps, just in case.

I am using the latest: vcxsrv-64.1.20.1.4.installer.

@mviereck
Copy link
Owner

I does look so, because ./x11docker simexp/octave octave is not working now.

That is strange. The changes for -i did not change anything for the code path without -i.
I did a test run in Windows VM with latest x11docker and same VcXsrv version, running xterm in Cygwin, everything works well. (x11docker --vcxsrv --exe xterm)

Currently I have no idea.

@eine
Copy link
Contributor

eine commented Jan 24, 2019

That is strange. The changes for -i did not change anything for the code path without -i.

There must be some misconfiguration in my current setup. I tried with v5.2.0 and it is not working. It is quite frustrating that neither x11docker, nor the X server or the app in the container complain about anything. Everything looks correct, but nothing is shown.

@mviereck
Copy link
Owner

There must be some misconfiguration in my current setup.

You once said Windows shows a warning and prompts to allow network access from container to X over IP. Could the issue be there? Windows blocking access and setting the process on hold?

@eine
Copy link
Contributor

eine commented Jan 24, 2019

That was it. Stupid firewall. Let me run some tests and I will update.

@eine
Copy link
Contributor

eine commented Jan 25, 2019

Well, after the issues with the firewall, the interactive mode works great in MSYS2. Thanks for your time @mviereck!

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

3 participants