Skip to content

Instantly share code, notes, and snippets.

@gzagatti
Last active May 5, 2017 19:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gzagatti/873c474ee5b2b22d3ad1ab415031c420 to your computer and use it in GitHub Desktop.
Save gzagatti/873c474ee5b2b22d3ad1ab415031c420 to your computer and use it in GitHub Desktop.
Using decktape docker image on a Mac

Decktape offers a Docker image in order to run their presentation converter. If you want to convert a presentation from an instance running on localhost on a Mac, it is necessary to do some work around.

Decktape's Github Page suggests that we run the following command to save a presentation deployed locally:

>> docker run --rm --net=host -v `pwd`:/slides astefanutti/decktape http://localhost:8000 slides.pdf

However when running the docker from a Mac, Docker is actually running behind a virtual machine and has no access to the localhost. Thus the option --net=host leads to a connection refused error.

In order to bypass this problem, we first need to find out what the IP address of the preferred network interface in the OSX host is, from this StackOverflow answer we use:

 >> echo "show State:/Network/Global/IPv4" | scutil | grep PrimaryInterface | awk '{print $3}' | xargs ifconfig | grep inet | grep -v inet6 | awk '{print $2}'
10.226.98.247

With the IP address in hand, we can add a new host to the docker instance and then access the page from this added host:

>> docker run --rm --add-host dockerhost:10.226.98.247 -v `pwd`:/slides astefanutti/decktape http://dockerhost:8000 slides.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment