covid19model/docker
Fabian Valka 6d33b41f20
Missing changes to the docker/README.md
I've added the missing changes to the README.md to reflect changes I've made in the Dockerfile.
2020-04-11 18:07:13 +02:00
..
Dockerfile Fixed Rplots permission 2020-04-11 02:08:08 +02:00
README.md Missing changes to the docker/README.md 2020-04-11 18:07:13 +02:00
run_model_script.sh Added logic to trigger debug run via environment variable 2020-04-03 14:25:26 +01:00

README.md

Running the code with Docker

Docker provides an alternative way to run the model without the need to manually setup or install any dependencies. The Docker file contains the latest version of the model and can be used to run it independently of the repo.

Running on Linux or MacOS

docker run --rm -v $(pwd)/results:/var/model/results -v $(pwd)/figures:/var/model/figures harrisonzhu5080/covid19model:latest

Running on Windows using PowerShell

docker run --rm -v ${pwd}/results:/var/model/results -v ${pwd}/figures:/var/model/figures harrisonzhu5080/covid19model:latest

Settings

Two environment variables are supported for setting the model run parameters:

  • DEBUG=TRUE, performs a very fast debug run
  • FULL=TRUE, performs a full run of the model

Those options can also be passed directly to base.r on the command line setting either --full or --debug.

When neither option is set a longer debug run is performed. For proper estimates always use FULL=TRUE or the --full flag.

The usual option of setting the user for Docker --user $(id -u):$(id -g) is also supported.

Running custom changes using Docker

If you want to run your own changes in the Docker image above the whole work directory can be mounted as volume replacing, the contents in the Docker image itself.

Linux or MacOS

docker run --rm -v $(pwd):/var/model harrisonzhu5080/covid19model:latest

Other files in the directory can also be run, using:

docker run --rm -v $(pwd):/var/model harrisonzhu5080/covid19model:latest Rscript <filename>

Windows using PowerShell

docker run --rm -v ${pwd}:/var/model harrisonzhu5080/covid19model:latest

Other files in the directory can also be run, using:

docker run --rm -v ${pwd}:/var/model harrisonzhu5080/covid19model:latest Rscript <filename>

Building the Docker image

A Dockerfile is provided in the docker directory. To build an image containing all of the dependencies of the model run the following command from the root directory of the project:

docker build -f docker/Dockerfile -t covid19model:latest .