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 a number of use cases, including:

  1. Code documentation: Doxygen can extract comments in the source code and create documentation that describes the various functions, classes, and other elements of the code. This documentation can be very useful for developers who need to understand the code, and for new developers who are trying to learn how to work with the code.
  2. API documentation: Doxygen can be used to generate documentation for APIs (Application Programming Interfaces), which are used to interact with software libraries or frameworks. This documentation can be very helpful for developers who are using the API, as it can provide information on how to use the API and what its various functions and parameters do.
  3. Project documentation: Doxygen can generate documentation for entire software projects, including not just the code, but also the project structure, requirements, and other information. This can be useful for project managers, stakeholders, and other non-technical team members who need to understand the project.
  4. Code analysis: Doxygen can also be used to analyze code and identify potential issues, such as unused variables, missing function declarations, and more. This can be helpful for developers who are trying to improve the quality of their code or identify potential bugs before they cause problems.

Install Docker or Docker Rootless

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

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

This command runs a Docker container with the image “”, 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'
    image: caddy:alpine
    container_name: doxygen_caddy
    restart: unless-stopped
      - web
      - /opt/docker/www/
      - /opt/docker/www/


and put this in the caddyfile: {
	root * /var/www/html

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.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *