Skip to content

Instantly share code, notes, and snippets.

@nestarz
Forked from stonehippo/docker_x11_gui_osx.md
Last active September 13, 2019 07:39
Show Gist options
  • Save nestarz/84071f6725a65f5cae2440e9f452fe74 to your computer and use it in GitHub Desktop.
Save nestarz/84071f6725a65f5cae2440e9f452fe74 to your computer and use it in GitHub Desktop.
Getting X11 GUI applications to work on OS X with Docker

Getting X11 GUI applications to work on OS X with Docker

$ brew install socat
$ brew cask install xquartz <--- assuming you don't already have XQuartz installed some other way
$ open -a XQuarts <--- start an XQuartz session

$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"

If exists, list all and kill them:

$ sudo lsof -iTCP -sTCP:LISTEN -n -P 
$ kill -9 

In a new terminal:

$ inconfig

Look for the IP address assigned to your Docker VM; the interface will be something like vboxnet0 or vboxnet1

$ docker run --rm -e DISPLAY=[IP address of vboxnet0]:0 [image] [command]

For example, to run the Arduino IDE, I've used

$ docker run --rm -e DISPLAY=192.168.99.1:0 davechick/arduino-dev arduino

See moby/moby#8710 for more info

import moviepy.editor as mp

#pygame.display.set_caption('without adobe, with open source')

moments = [ [((10, 47), (10, 57)), ((16, 2), (16, 10))], [(0.0, (0, 10))], [((3, 32), (5, 00))], [((16, 30), (17, 0))], ]

clips = [ mp.VideoFileClip("assets/GP0{i}7830.MP4".format(i=i)).subclip( t_start, t_end) for i in range(len(moments)) for t_start, t_end in moments[i] ]

final_clip = mp.concatenate_videoclips(clips).resize(height=1080)

#final_clip.preview(audio=False) final_clip.write_videofile('composition.mp4', fps=24, preset="ultrafast", threads=8, ffmpeg_params=[ '-movflags', '+faststart', '-crf', '18', '-g', '30', '-coder', '1', '-pix_fmt', 'yuv420p', '-bf', '2', '-c:a', 'aac', '-b:a', '384k', ])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment