Docks: Easy Dockerfile Documentation Generator 📜🐳
docks is a Python framework designed to generate Markdown documentation for your Dockerfiles. It extracts key elements such as base images, ARG/ENV variables, exposed ports, and copied/added files, producing clear, structured documentation.
Features ✨
- Extracts:
- Base Images (
FROM) - ARG/ENV Variables with optional docstrings and references
- Exposed Ports with descriptions
- Copied/Added Files (
COPY/ADD) with context
- Base Images (
- Outputs clean Markdown documentation for your Dockerfiles.
- Easy to use, modular, and extensible.
Installation 🚀
Install docks via Poetry or pip:
Using Poetry
poetry add docks
Using Pip
pip install docks
Usage 🛠️
Via CLI
The docks CLI allows you to quickly generate Markdown documentation for a Dockerfile without writing code.
Here is all you have to do in order to generate the documentation.
docks <dockerfile> <output>
# e.g.
# docks myproject/Dockerfile myproject/dockerfile-doc.md
CLI Arguments
dockerfile: Path to the Dockerfile to document.output: Path to save the generated Markdown documentation.
Via Python
You can also easily create the documentation programmatically via Python.
Example: Generate Documentation from a Dockerfile
- Ensure you have a valid Dockerfile in your project.
- Run the following Python script
from docks.generate_doc import generate_markdown
# Path to your Dockerfile
dockerfile_path = "Dockerfile"
# Output Markdown file
output_path = "README.md"
# Generate documentation
generate_markdown(dockerfile_path, output_path)
Dockerfile Docstring Convention 📝
ARG/ENV Variables
- Include a block comment directly above the variable.
- Start the comment with the variable name followed by
:for docstring extraction. - Optionally include a reference using
@ref:.
Example
# MY_VAR: Description of the variable.
# @ref: https://example.com/docs
ARG MY_VAR=default
EXPOSE Ports
Include a comment directly above the EXPOSE command.
Start with the port number followed by : for the description.
Example
# 8080: Main HTTP server port
EXPOSE 8080
COPY/ADD Files
Add a comment directly above the COPY or ADD command for context.
Example
# Copy application code to the container
COPY src/ /app/
Testing ✅
Run tests with pytest:
pytest tests/
Contributing 🤝
We welcome contributions! Please follow these steps:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/<FEATURE_NAME>. - Commit your changes:
git commit -m "Add feature". - Push the branch:
git push origin feature/<FEATURE_NAME>. - Open a pull request.
Metadata
Release files for docks 0.1.13
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| docks-0.1.13.tar.gz | 7.3 kB | Without provenance | Details for docks-0.1.13.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| docks-0.1.13-py3-none-any.whl | Python 3 | none | any | Details for docks-0.1.13-py3-none-any.whl |
Total release size: 16.1 kB
Release files / docks-0.1.13.tar.gz
| Download URL | docks-0.1.13.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82085e69a592cd96153a2decb56b41b5c2a45965832f576ca4781dcf41087820
|
|
BLAKE2b-256 checksum How to use checksums |
37c15a15a6246a5dfb3361d97cdaee4d045dc1bd5ac9d79609192a8d82bc608d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / docks-0.1.13-py3-none-any.whl
| Download URL | docks-0.1.13-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
78087830aa5afefca15f78453f75443b28f490932f56d455fe6c32fc818435e6
|
|
BLAKE2b-256 checksum How to use checksums |
95e15bc9b1a14b48c8a86b74f94af7602b3891804af55c1732dd5863e55dedce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Security for docks 0.1.13
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.