Container comes loaded with neural-style, an algorithm to combine the style of one image with the content of another, found here https://github.com/jcjohnson/neural-style.
Use the command
docker run -it --env="DISPLAY" --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" dorakorpar/nsgui:latest
to open a container, then
inside the container to open the GUI.
Currently only compatible with Linux systems.
Check out the source code here https://github.com/DoraKorpar/DockerCon-Challenge.
I got this to work on my Mac ( screenshot located here: https://www.durossette.com/img/nsgui_on_mac.png
Things i have tried:
Set the DISPLAY environment variable to different values (did not work)
Set ForwardX11=yes in /etc/ssh/ssh_config (I know this is server and I think that the issue is client, but what the heck, let’s poke it and see) (did not work, did not expect it to)
Googled “jessfraz X11 mount”, read her blog post here: https://blog.jessfraz.com/post/docker-containers-on-the-desktop/ and in that post she refers to tricks to get it to work on mac, so I used the message thread located here https://github.com/docker/docker/issues/8710 (worked)
What worked (solution #3):
(Update brew and brew cask)
- brew update
- Had to install cask - brew install brew-cask
— commands I ran from a terminal window
— install socat
brew install socat
brew cask install xquartz
--<reboot - because the DISPLAY environment variable was not set>
--open Quartz server
open -a XQuartz
--start a socat session
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
--in another (second terminal window) window
--use ifconfig to find out the IP address of the VirtualBox
ifconfig ( look for the IP address associated with vboxnet0 )
--run the container, setting the DISPLAY to the IP
docker run -it -e DISPLAY=192.168.99.1:0 dorakorpar/nsgui
First, let me say I love the idea behind this. Apps inside containers is a powerful dream, even more so if we can get to a true cross-platform ideal. I was looking for a small project to play with and when I found the writeup on this it sounded fun. ( https://blog.docker.com/2016/06/dockercon-cool-docker-hack/ ) Thank you!
I am assuming that when you say "Currently only compatible with Linux systems." you mean that in the literal, and are not including the MAC as a "Linux system". I believe anyone who is successful at coding knows the value of precise wording and characters, every single character counts. ;-)
But I also like to experiment take things apart to see how they work. I tried to run this on my Mac for fun and games, and the first thing I found was that the DISPLAY environment variable was not being passed into the container (an $ env command confirmed this), so the _tkinter.create() function failed with this error message:
_tkinter.TclError: no display name and no $DISPLAY environment variable
Perhaps Docker has changed and empty environment variables are tossed out/not honored? Or perhaps the Docker flavor for Mac is "unique"? ;-)
I now better understand the part of the blog post where you detail issues with X11 and _tkinter.
I have tried a few things so far:
$ export DISPLAY
_tkinter.TclError: couldn't connect to display ""
$ export DISPLAY=":0"
_tkinter.TclError: couldn't connect to display ":0"
Here are my thoughts on "Things Still Left To Try":
Keep reading up on the vagaries of Docker, tkinter, X11, etc. I suspect I am not catching the right X11 display because I am connected to a container and not local. It's been a long time since I played with XWindows, but this is the first thing i am going to try.
Just build a true Linux VM and run from there. Might work, but there also could be issues with a Virtual Machine.
Take an old computer and just load Linux on it. Also might work, but due to the the nature of Linux, distort selection, graphics card, X11 config, this also might be a long road.
Ask for help. Hmm, not really in my nature, but it could work...