Search code examples
dockerjupyter-notebookdocker-machine

How load docker-machine env inside Jupyter Notebook?


I'm looking for a way to load docker-machine env with my python kernel. Now when I run build with docker, I'm obtain the follow error:

Running S2I version "v1.1.14-dirty"
FATAL: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
make[1]: *** [docker/build] Error 1

If I run with %%bash, works, but it are not usual:

%%bash

eval "$(docker-machine env)"

make docker/build

Solution

  • Prepending with eval works fine:

    !eval "$(docker-machine env)" && make docker/build