Skip to content

Running wradlib docker with Windows 7 and Docker Toolbox

Maik Heistermann edited this page Aug 28, 2017 · 5 revisions

This page provides some experiences with Windows 7 and Docker Toolbox.

Git/bash installation

Docker Quick Start Terminal (QST) uses the bash which comes with git, and expects to find bash at C:/Program Files/Git/bin. Usually, this can only be achieved in case you use admin rights during git installation. You could also install the git which ships together with the docker toolbox installation package - however, the installation of docker with git failed on my machine. So I install git manually with admin rights (to C:/Program Files/Git/bin, then installed docker with admin rights (unchecking the git installation). Sounds weird? I guess it does...

Docker PATH

Similar problem: Installing docker with admin rights adds docker to the admin accounts' path, only. In order to use docker with another user, you have to add docker to your system path or your user path manually.

Referencing the docker image

Running the image like

$ docker run [...] wradlib:latest [...]

does not work. I had to replace the wradlib:latest part by wradlib/wradlib-docker. Short test:

$ docker pull wradlib/wradlib-docker
$ docker run wradlib/wradlib-docker

Memory

I had to remove the default VM and create a new one with more memory. Otherwise I'd run into a no space left on device error. Instead of removing the default machine (via $ docker-machine rm default), you could also create a new one and name it e.g. wradlibmachine.

$ docker-machine create -d virtualbox --virtualbox-cpu-count=2 --virtualbox-memory=4096 wradlibmachine

How to mount host directories to the Docker container?

I tried for some time mounting volumes, but had problems with the file permissions on the mounted directory. This how I finally set it up (thanks to here:

  1. Stop the current docker machine (let's say it's name is wradlibmachine:

    $ docker-machine stop wradlibmachine

  2. Open the VirtualBox GUI. Right-click the corresponding docker machine (should be powered off), then go for

    Settings > Shared Folders > Add new shared folder

    Add a name and the corresponding path on your host system (e.g. the paths to your notebooks and to your wradlib-data. Check auto-mount for each.

  3. Via Docker Quickstart Terminal, start your docker machine and ssh into it:

    $ docker-machine start wradlibmachine $ docker-machine ssh wradlibmachine

  4. Now perform the mount from docker-side

    $ sudo mkdir /notebooks_share
    $ sudo mount -t vboxsf notebooks /notebooks_share
    $ sudo mkdir /wradlib-data_share
    $ sudo mount -t vboxsf wradlib-data /wradlib-data_share
    

    As far as I understand it, the mount is done on the virtual machine box. You can then refer to this mount anytime later when you are running containers. E.g. when you mount the volumes to the wradlib container like this:

  5. This is the way to include these volumes on your wradlib-docker container:

    $ docker run -i -t -p 8888:8888 --volume /notebooks_share:/home/notebooks --volume /wradlib-data_share:/home/wradlib-data -e WRADLIB_DATA=/home/wradlib-data wradlib/wradlib-docker
    

Launching Jupyter notebook in Docker and finding notebook server on host

Somehow, pointing the Juypter notebook server to the hosts localhost does not work. Instead, I succeeded in connecting to the notebook server on docker this way:

  1. Get the IP address of your docker machine. Before you ssh into the machine, type

    $ docker-machine ip wradlibmachine

  2. Now ssh into the machine and start the wradlib-docker container (see above).

  3. In the wradlib-docker container, do

    $ source activate wradlib
    $ jupyter notebook --ip="*" --port=8888 --notebook-dir=/home/notebooks
    
  4. Copy the URL generated by Jupyter (incl. the token) into your host's browser and replace the ip address by the IP address you've retrieved under (1). So if the machine IP is e.g. 192.168.99.101

    http://localhost:8888/?token=d0ae784bae61d04aafccc857ec20422fc8be3cb3b741cf21

    should become

    http://192.168.99.101:8888/?token=d0ae784bae61d04aafccc857ec20422fc8be3cb3b741cf21

Now you should finally be there...

Re-create docker-machine from time to time

With a couple of tries starting the notebook server from the docker-machine, I suddenly ran into a MemoryError again. Restarting the docker-machine returned

$ docker-machine restart default
Restarting "default"...
(default) Check network to re-create if needed...
(default) Waiting for an IP...
Waiting for SSH to be available...
Detecting the provisioner...
Unable to verify the Docker daemon is listening: Maximum number of retries (10)
exceeded

Turned out I have to re-create the machine (https://github.com/docker/machine/issues/2879). So I did (see above).