Add Dockerfile and instructions for running container

This commit is contained in:
LeoVerto 2018-08-31 05:16:34 +02:00
parent ab88c610e1
commit dc950fae29
2 changed files with 22 additions and 1 deletions

10
Dockerfile Normal file
View file

@ -0,0 +1,10 @@
FROM python:3-alpine
WORKDIR /usr/src/app
COPY docker-net-graph.py Pipfile Pipfile.lock ./
RUN pip install pipenv
RUN pipenv install --system --deploy
CMD ["python", "docker-net-graph.py"]

View file

@ -20,4 +20,15 @@ In most cases what you want to run are the following couple commands:
pipenv install pipenv install
pipenv run python docker-net-graph.py -o output.gv pipenv run python docker-net-graph.py -o output.gv
This will end up generating a .pdf file containing the graph. This will end up generating a .pdf file containing the graph.
## Running inside docker
If you want to generate a graph for a remote system you can also easily
run this script inside a pre-built docker container:
docker run -v /var/run/docker.sock:/var/run/docker.sock leoverto/docker-net-graph
This will just generate and output the graph. You can then run
`dot -Tpdf -o out.pdf`or `dot -Tpng -o out.png` on a system with
graphviz installed, paste the previous output there, press enter
and finally CTRL+C to generate the file.