Using VIC with Docker

Docker is an open-source application container engine. Docker containers allow us to distribute a light-weight, virtual machine that includes the required dependencies to run VIC. VIC developers maintain a single Ubuntu docker image with the minimum requirements to run the VIC classic and image drivers.

Getting Started with Docker

Docker images may be run on most computers running Linux, Mac OS X, or Windows operating systems. To run docker images, Docker Engine or "Docker" must be installed on the host computer. The Docker documentation provides specific instructions for installing Docker for each support operating system.

Getting the VIC Docker Image

We provide a single stable light-weight Docker image that includes the minimum requirements to run VIC (e.g. gcc, netCDF, MPI). This image is distributed via Docker Hub and is called docker_vic.

# Pull the docker_vic
docker pull uwhydro/vic:docker_vic
# List available docker images, docker_vic should be listed
docker images
# Run the docker_vic, this will just build the VIC drivers and exit
docker run -i uwhydro/vic:docker_vic
# Open an interactive bash command line in the docker_vic
docker run -it uwhydro/vic:docker_vic /bin/bash

Running VIC Inside a Docker Image

Once inside an interactive session inside the docker_vic, we already have the VIC Git repository and all the dependencies to build and run VIC.

# change directories to the VIC Classic Driver
cd VIC/vic/drivers/classic
# Build the Classic Driver
# Run VIC
./vic_classic.exe -g global_param_file.txt

Testing with Docker Images

We are currently building a test platform that will be run using Docker. Stay tuned for more information on this.

References: - Github Issue #50 - Github Issue #79 - Github Issue #350 - wercker

Other Useful Docker Tips

Adding other software to the docker_vic

Docker images can be treated just like a normal unix machine, so software can be added using package managers like apt-get or anaconda. For example, to add the vim text editor:

apt-get install vim

Mounting external directories to the docker_vic

The docker_vic doesn't include any data to run VIC, so most users will need to either download data into their image or, more commonly, mount a local volume to the Docker image. Docker makes this easy, this command mounts a local directory (e.g. ~/workdir/VIC_data/) to the docker_vic.

# Open an interactive bash command line in the docker_vic
# mounting a local directory
docker run -it -v ~/workdir/VIC_data:~/workdir/VIC_data uwhydro/vic:docker_vic /bin/bash