Entangle Sodium on macOS with Docker

As Entangle Sodium only works in Linux, I thought wouldn’t it be weird cool if we could run it in macOS? Well one problem is the dependency on the Linux-only libudev. That’s an easy one, run it in a virtual Linux. Docker images provide a virtual Linux which run in a Virtual Machine. Another problem is that the default docker-machine will not forward USB devices to the container. There is an elegant workaround, albeit deprecated / migrated / unpopular / officially highly discouraged, and that is to boot up the lightweight boot2docker linux machine in VirtualBox. We must do this because it allows us to express the USB bus as a directory: /dev/bus/usb, as macOS does not provide the USB bus in files. The docker image is pulled to the boot2docker machine, where it may permanantly reside, and run with a privileged mode that allows access to that linux’s /dev tree. The boot2docker ISO for VirtualBox can be found here:

Entangle docker instructions for macOS

Runs entangle in boot2docker VM and copies captures to timestamped dir in ~ on host.


  • First Terminal

  1. open -a Xquartz
  2. socat TCP-LISTEN:6000,bind=$(ifconfig -a|tail +9|grep 'inet '|cut -d ' ' -f 2|head -1),reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
  • In Second Terminal

  1. echo $(ifconfig -a|tail +9|grep 'inet '|cut -d ' ' -f 2|head -1) > /private/var/tmp/hostip
  2. echo $HOME>/private/var/tmp/homedir
  • In VirtualBox

  1. Settings > Ports: add USB2 or USB3 driver and add the filter for your connected camera.
  2. Settings > Shared Folders: add Folder Path /private/var/tmp with Mount Point /tmp2 and Folder Path /Users with Mount Point /Users making both permanent automounts.
  3. Start the boot2docker VM
  4. docker pull kd6kxr/entangle
  5. docker run -it -e DISPLAY=$(cat /tmp2/hostip):0 -v /tmp/.X11-unix:/tmp/.X11-unix -v $(cat /tmp2/homedir):/hi -v /dev/bus/usb:/dev/bus/usb --privileged kd6kxr/entangle
  6. Upon success the container will quit and have copied your files to a new dir in ~. On failure, you will exit to bash where you may recover files, then exit when finished.
  • An easier thing to type than the docker run command above: curl https://tinyurl.com/entangleme -L > cmnd && chmod +x cmnd
  • Then run the image with ./cmnd

Here’s the Dockerfile which auto-builds from the official entangle repo.


This is the docker autobuild repo I’ve made: https://cloud.docker.com/repository/docker/kd6kxr/entangle


And of course, the source code lives here:

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

As a reward for reading this far, here is a capture of entangle capturing entangle capturing entangle capturing entangle...

2 Likes

Interesting solution.