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.
This commit is contained in:
Fabian Valka 2020-04-11 18:07:13 +02:00 коммит произвёл GitHub
Родитель e6cdf3c8a3
Коммит 6d33b41f20
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 43 добавлений и 16 удалений

Просмотреть файл

@ -1,32 +1,59 @@
# Running the code with Docker
[Docker][] provides an alternative way to run the model without the need to
manually setup or install any dependencies. For Linux or MacOs, from the root
directory of the project run the command:
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 -it -v $(pwd):/var/model harrisonzhu5080/covid19model:latest $(id -u) $(id -g)
docker run --rm -v $(pwd)/results:/var/model/results -v $(pwd)/figures:/var/model/figures harrisonzhu5080/covid19model:latest
```
If your user is not in the docker group then you will need to run the above
command prefixed with `sudo`. The same applies to all following commands.
In the above, the `-v $(pwd)/:/var/model` option makes the current directory
accessible when the container is run. This means the code which is executed is
that in the current directory and includes any changes made. The use of `$(id
-u)` and `$(id -g)` ensure that all model output files will be owned by the
current user instead of root.
If using Powershell on Windows, from the root directory of the project run the
command:
### Running on Windows using PowerShell
```
docker run --rm -it -v ${pwd}:/var/model harrisonzhu5080/covid19model:latest 0 0
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>
```
[Docker]: https://www.docker.com/
# Building the Docker image
## 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