diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..668d19c --- /dev/null +++ b/Dockerfile @@ -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"] \ No newline at end of file diff --git a/README.md b/README.md index 85231dd..3298024 100644 --- a/README.md +++ b/README.md @@ -20,4 +20,15 @@ In most cases what you want to run are the following couple commands: pipenv install pipenv run python docker-net-graph.py -o output.gv -This will end up generating a .pdf file containing the graph. \ No newline at end of file +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. \ No newline at end of file