A Docker image for MkDocs to build code documentation
150
A Docker image for MkDocs, using an official Python image based on Alpine Linux.
The image allows you to create, build, and serve MkDocs documentation projects without requiring a local Python or MkDocs installation.
The Dockerfiles used to build this image are available at:
https://github.com/ajg555/mkdocs-dockerfiles
Official MkDocs repository:
https://github.com/mkdocs/mkdocs
Official MkDocs documentation:
https://www.mkdocs.org/user-guide/installation/
Create a new MkDocs project in the current directory:
docker run --rm \
--name mkdocs \
-v "$PWD:/docs" \
mkdocs new my-wiki
Then enter the newly created project:
cd my-wiki
Build the documentation project:
docker run --rm \
--name mkdocs \
-v "$PWD:/docs" \
mkdocs build
The generated website will be available in the site/ directory.
Start the MkDocs development server:
docker run --rm \
--name mkdocs \
-p 8000:8000 \
-v "$PWD:/docs" \
mkdocs
The default command is equivalent to:
mkdocs serve --dev-addr=0.0.0.0:8000
The documentation will be available at:
docker run --rm \
--name mkdocs \
-v "$PWD:/docs" \
mkdocs --help
docker run --rm \
--name mkdocs \
-v "$PWD:/docs" \
mkdocs --version
To simplify usage, you can create an alias for the Dockerized MkDocs command.
Add the following to your ~/.bashrc:
alias mkdocs="docker run \
--rm \
--name mkdocs \
-p 8000:8000 \
-v \"\$PWD:/docs\" \
mkdocs"
After adding the alias, reload your shell:
source ~/.bashrc
You can then use MkDocs normally:
mkdocs new my-wiki
mkdocs build
mkdocs serve
The commands are executed inside the Docker container without requiring a local MkDocs installation.
Content type
Image
Digest
sha256:e25f088c6…
Size
36.9 MB
Last updated
about 1 month ago
docker pull ajg555/mkdocs