Skip to content

Commit

Permalink
#236: - added docker usage to README.md
Browse files Browse the repository at this point in the history
- removed not needed files from docker image
  • Loading branch information
Marcin Wróbel committed Aug 22, 2022
1 parent 71462e9 commit 026af97
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 23 deletions.
51 changes: 31 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,40 +129,51 @@ python JSON_data_files_validator.py --dir_path=<project-path>/data/8color-4node
python JSON_data_files_validator.py --dir_path=../../data/8color-4node --file_prefix=data --file_suffix=json
```

[//]: # (## Getting Started with Docker)
## Getting Started with Docker

[//]: # (### Example use:)
### Example use:

[//]: # ()
[//]: # (Replace `<in_dir>` with path to existing directory which will be mapped with `/lbaf/in` in container)
Replace `<in_dir>` with path to existing directory which will be mapped with `/lbaf/in` in container

[//]: # ()
[//]: # (Replace `<out_dir>` with path to existing directory which will be mapped with `/lbaf/out` in container)
Replace `<out_dir>` with path to existing directory which will be mapped with `/lbaf/out` in container

[//]: # (```shell)
Put `conf.yaml` inside mapped `<in_dir>` and set `output_dir` in `conf.yaml` to `/lbaf/out`

[//]: # (docker run -it -v "<out_dir>:/lbaf/out" -v "<in_dir>:/lbaf/in" nganalytics/lbaf "python src/Applications/NodeGossiper.py -l /lbaf/data/vt_example_lb_stats/stats -x 4 -y 2 -z 1 -s 0 -f 4 -k 4 -i 4 -c 1 -e" "/bin/bash")
When using sample data from repository set `data_stem` in `conf.yaml` to e.g. `/lbaf/data/synthetic_lb_data/data`

[//]: # (```)
When using other data put the data inside mapped `<in_dir>` and set `data_stem` in `conf.yaml` to e.g. `/lbaf/in/<your_data_dir>/<data_name_prefix>`

[//]: # (### Example use explained:)
#### Building locally (otherwise docker image will be pulled from dockerhub):
```shell
cd <main_repository_directory>
docker build -t nganalytics/lbaf:latest . -f lbaf.Dockerfile
```

#### Running:
```shell
docker run -it -v "<out_dir>:/lbaf/out" -v "<in_dir>:/lbaf/in" nganalytics/lbaf "python /lbaf/src/lbaf/Applications/LBAF_app.py --config=/lbaf/in/conf.yaml" "/bin/bash"
# in order to exit container
exit
```

### Example use explained:

[//]: # (- container starts with interactive mode &#40;stdout visible&#41;)
- container starts with interactive mode (stdout visible)

[//]: # (- two volumes are mounted&#40;data exchange between host and container possible&#41;:)
- two volumes are mounted(data exchange between host and container possible):

[//]: # ( - directory `<in_dir>` on the host and `/lbaf/in` is mount inside container)
- directory `<in_dir>` on the host and `/lbaf/in` is mount inside container

[//]: # ( - directory `<out_dir>` on the host and `/lbaf/out` is mount inside container)
- directory `<out_dir>` on the host and `/lbaf/out` is mount inside container

[//]: # (- docker image `nganalytics/lbaf`)
- docker image `nganalytics/lbaf`

[//]: # (- commands executed inside container:)
- commands executed inside container:

[//]: # ( - sample LBAF usage:)
- sample LBAF usage:

[//]: # ( ```"python src/Applications/NodeGossiper.py -l /lbaf/data/vt_example_lb_stats/stats -x 4 -y 2 -z 1 -s 0 -f 4 -k 4 -i 4 -c 1 -e"```)
```"python /lbaf/src/lbaf/Applications/LBAF_app.py --config=/lbaf/in/conf.yaml"```

[//]: # ( - command to stay inside container, after above command is completed:)
- command to stay inside container, after above command is completed:

[//]: # ( ```"/bin/bash"```)
```"/bin/bash"```
3 changes: 0 additions & 3 deletions lbaf.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ ENV DISPLAY :99.0
COPY src /lbaf/src
COPY data /lbaf/data
COPY scripts/entrypoint.sh /lbaf/entrypoint.sh
COPY scripts/test_lbaf.py /lbaf/tests/test_lbaf.py
COPY scripts/run_tests.sh /lbaf/tests/run_tests.sh
COPY scripts/test_config/conf.yaml /lbaf/src/Applications/conf.yaml

WORKDIR /lbaf
RUN mkdir /lbaf/in /lbaf/out
Expand Down

0 comments on commit 026af97

Please sign in to comment.