DEV Community

krishna
krishna

Posted on

Creating block diagrams from docker-compose files

A docker-compose file contains the definition of all the services that needs to run in harmony to successfully deploy an app stack.

When services and their interactions are defined clearly in a compose file manually charting a block diagram to list those services and their interaction is redundant, isn't it ? that was the thought I had when I needed to chart a block diagram for documenting my architecture.

A quick search using "tool to convert a docker compose file to a block diagram" yielded this awesome repo https://github.com/pmsipilot/docker-compose-viz

The code in this repo will help us to chart a block diagram from a docker compose file.

Lets create one!
  • Sample docker-compose of a simple SaaS stack

  • Command to execute

    docker run 
    --rm -it \
    --name dcv \ 
    -v /home/user/blog:/input pmsipilot/docker-compose-viz \
    render -m image \
    --force docker-compose.yml \
    --output-file=topology.png \
    --no-volumes \
    --no-ports \
    --no-networks
    
  • Ouptput

Alt Text

  • Command - With port numbers
docker run 
--rm -it \
--name dcv \ 
-v /home/user/blog:/input pmsipilot/docker-compose-viz \
render -m image \
--force docker-compose.yml \
--output-file=topology.png \
--no-volumes \
--no-networks
  • Ouptput - with ports
    Alt Text

  • Command - With volumes

docker run 
--rm -it \
--name dcv \ 
-v /home/user/blog:/input pmsipilot/docker-compose-viz \
render -m image \
--force docker-compose.yml \
--output-file=topology.png \
--no-ports \
--no-networks
  • Ouptput - with volumes Alt Text

Top comments (0)