Skip to content
SumGuy's Ramblings
Go back

Install & use Doxygen via Docker

Doxygen & its use cases

Doxygen is a documentation generator tool that can be used to generate documentation for software projects in various programming languages, such as C++, Java, Python, and more. It extracts comments from source code and generates documentation in various formats, such as HTML, PDF, and LaTeX.

Doxygen has several use cases, including:

Install Docker or Docker Rootless

How to install Docker rootlessHow to install Docker rootless

Install docker on Ubuntu/DebianInstall docker on Ubuntu/Debian

Running Doxygen with Docker!

the premise : you have your source code in a folder named: source your output is going to be in a folder named: output your doxygen file is named: Doxygen

your doxygen file has at least these two entries modified: INPUT = /source OUTPUT_DIRECTORY = /output

you can also enable dot HAVE_DOT               = YES

and IF you want call graphs enabled : CALL_GRAPH             = YES

docker run --rm -it -v ./source:/source -v ./output:/output -v ./Doxygen:/Doxygen ghcr.io/kingpin/doxygen-docker:latest

This command runs a Docker container with the image “ghcr.io/kingpin/doxygen-docker:latest”, which is a pre-configured Doxygen environment. The “run” command specifies that the container should be run, and the “–rm” flag specifies that the container should be removed after it exits.

The “-it” flag allocates a pseudo-TTY and enables interactive mode, which allows the user to interact with the container’s shell. The “-v” flag mounts the local directories “./source”, “./output”, and file called “./Doxygen” to the container’s directories “/source”, “/output”, and file “/Doxygen”, respectively. This enables the container to access files and folders from the local machine.

Overall, this command sets up a Doxygen environment in a Docker container and mounts local directories to the container so that Doxygen can generate documentation from files in the mounted source directory and output the results to the mounted output directory.

This will output everything to the /output folder. for example if you enabled html output, there will be ./output/html which you can then use a webserver to serve. for example :

version: '3'
services:
  doxygen_caddy:
    image: caddy:alpine
    container_name: doxygen_caddy
    restart: unless-stopped
    networks:
      - web
    volumes:
      - /opt/docker/www/trinitycore.net/data/output/html:/var/www/html
      - /opt/docker/www/trinitycore.net/Caddyfile:/etc/caddy/Caddyfile

networks:
  web:

and put this in the caddyfile:

example.com {
	root * /var/www/html
	file_server
}

You can run this manually or add the docker call to a shell script and run it via a cronjob. ** Coming soon same image but with cron built in so it can be run automatically on a schedule.*


Share this post on:

Previous Post
Wireguard VPN Server in Docker
Next Post
Automatic backup of docker Mysql or MariaDB container