Merge pull request #24 from cc-a/docker-readme

Updated Docker run instructions with DockerHub image details
This commit is contained in:
hbz 2020-04-05 15:02:07 +01:00 коммит произвёл GitHub
Родитель 9841ada081 00397498d6
Коммит 7baf21fb95
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 19 добавлений и 19 удалений

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

@ -22,9 +22,8 @@ conda activate covid19model
## Using Docker
All dependencies for the model can be provided by building a [Docker][]
image. Please note that using this method separate instructions are required to
run the model - [see details](docker/).
A [Docker][] image providing all model dependencies is available. See
[docker/README.md](docker/) for details of running the model with Docker.
[Docker]: https://www.docker.com/

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

@ -1,27 +1,17 @@
# Running the code with Docker
[Docker][] provides an alternative way to run the model without the need to
setup or install any dependencies.
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:
manually setup or install any dependencies. For Linux or MacOs, from the root
directory of the project run the command:
```
docker build -f docker/Dockerfile -t covid19model:latest .
docker run --rm -it -v $(pwd):/var/model harrisonzhu5080/covid19model:latest $(id -u) $(id -g)
```
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 the below.
command prefixed with `sudo`. The same applies to all following commands.
This creates an image that can then be used to execute the model. For Linux or
MacOs, from the root directory of the project run the command:
```
docker run --rm -it -v $(pwd):/var/model covid19model:latest $(id -u) $(id -g)
```
In the above the `-v $(pwd)/:/var/model` option makes the current directory
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
@ -30,7 +20,18 @@ current user instead of root.
If using Powershell on Windows, from the root directory of the project run the
command:
```
docker run --rm -it -v ${pwd}:/var/model covid19model:latest 0 0
docker run --rm -it -v ${pwd}:/var/model harrisonzhu5080/covid19model:latest 0 0
```
[Docker]: https://www.docker.com/
# 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 .
```