MkDocs Material Documentation
Beautiful documentation with MkDocs Material theme and plugins.
Overview
MkDocs is a fast, simple static site generator specifically designed for building project documentation from Markdown files. Created by Tom Christie in 2014, MkDocs follows the philosophy that documentation should be easy to write, maintain, and deploy. The Material theme, developed by Martin Donath, transforms MkDocs into a modern documentation platform with Google's Material Design principles, offering advanced features like instant search, navigation tabs, and responsive layouts that rival commercial documentation platforms.
This stack combines the MkDocs Material theme with NGINX to create a complete documentation pipeline. During development, MkDocs runs its built-in development server with live reload capabilities, automatically rebuilding pages as you edit Markdown files. For production deployment, the build service compiles your documentation into static HTML files, which NGINX then serves with optimal performance and caching. This separation allows for rapid iteration during content creation while ensuring production-grade performance for end users.
This configuration is ideal for software teams, open-source maintainers, and technical writers who need professional documentation without the complexity of headless CMS systems or wiki platforms. The Material theme provides enterprise-grade features like multi-language support, version switching, and advanced search capabilities, while maintaining the simplicity of Markdown authoring. The combination of MkDocs' Python-based ecosystem with NGINX's proven web serving capabilities creates a documentation platform that scales from personal projects to large enterprise deployments.
Key Features
- Material Design 3 theme with customizable color schemes, typography, and navigation patterns
- Instant client-side search powered by lunr.js with result highlighting and keyboard navigation
- Live reload development server that automatically rebuilds and refreshes pages on Markdown changes
- Built-in support for code syntax highlighting with over 200 programming languages via Pygments
- Navigation tabs, sections, and automatic table of contents generation with anchor linking
- Social cards generation for improved link previews on platforms like GitHub, Slack, and Twitter
- Mermaid diagram integration for flowcharts, sequence diagrams, and architectural documentation
- Plugin ecosystem including git revision dates, PDF export, and multi-language internationalization
Common Use Cases
- 1Software project documentation with API references, user guides, and developer onboarding materials
- 2Technical writing portfolios showcasing expertise in documentation tools and modern web technologies
- 3Internal company knowledge bases requiring search functionality and mobile-responsive design
- 4Open-source project documentation with contributor guidelines, installation instructions, and examples
- 5Educational content and tutorials with code examples, diagrams, and interactive elements
- 6Product documentation sites that need professional appearance without content management overhead
- 7Documentation-as-code workflows integrated with Git repositories and CI/CD pipelines
Prerequisites
- Docker Engine 20.10+ and Docker Compose v2 for container orchestration and service management
- Minimum 512MB RAM for MkDocs build processes and NGINX static file serving
- Port 8000 available for development server and port 80 for production NGINX deployment
- Basic understanding of Markdown syntax and YAML configuration for mkdocs.yml setup
- Familiarity with directory structure conventions for organizing documentation source files
- Git knowledge recommended for version control and documentation-as-code workflows
For development & testing. Review security settings, change default credentials, and test thoroughly before production use. See Terms
docker-compose.yml
docker-compose.yml
1services: 2 mkdocs: 3 image: squidfunk/mkdocs-material:latest4 ports: 5 - "8000:8000"6 volumes: 7 - ./docs:/docs8 command: serve --dev-addr=0.0.0.0:80009 networks: 10 - docs_net1112 mkdocs-build: 13 image: squidfunk/mkdocs-material:latest14 volumes: 15 - ./docs:/docs16 - ./site:/docs/site17 command: build18 profiles: 19 - build20 networks: 21 - docs_net2223 nginx: 24 image: nginx:alpine25 ports: 26 - "80:80"27 volumes: 28 - ./site:/usr/share/nginx/html:ro29 profiles: 30 - production31 networks: 32 - docs_net3334networks: 35 docs_net: .env Template
.env
1# MkDocs Material2# Dev server at http://localhost:80003# Build with: docker compose --profile build up4# Production with: docker compose --profile production upUsage Notes
- 1Dev server at http://localhost:8000
- 2Live reload on changes
- 3Material theme included
- 4Search, tabs, versioning
- 5Extensive plugin ecosystem
Individual Services(3 services)
Copy individual services to mix and match with your existing compose files.
mkdocs
mkdocs:
image: squidfunk/mkdocs-material:latest
ports:
- "8000:8000"
volumes:
- ./docs:/docs
command: serve --dev-addr=0.0.0.0:8000
networks:
- docs_net
mkdocs-build
mkdocs-build:
image: squidfunk/mkdocs-material:latest
volumes:
- ./docs:/docs
- ./site:/docs/site
command: build
profiles:
- build
networks:
- docs_net
nginx
nginx:
image: nginx:alpine
ports:
- "80:80"
volumes:
- ./site:/usr/share/nginx/html:ro
profiles:
- production
networks:
- docs_net
Quick Start
terminal
1# 1. Create the compose file2cat > docker-compose.yml << 'EOF'3services:4 mkdocs:5 image: squidfunk/mkdocs-material:latest6 ports:7 - "8000:8000"8 volumes:9 - ./docs:/docs10 command: serve --dev-addr=0.0.0.0:800011 networks:12 - docs_net1314 mkdocs-build:15 image: squidfunk/mkdocs-material:latest16 volumes:17 - ./docs:/docs18 - ./site:/docs/site19 command: build20 profiles:21 - build22 networks:23 - docs_net2425 nginx:26 image: nginx:alpine27 ports:28 - "80:80"29 volumes:30 - ./site:/usr/share/nginx/html:ro31 profiles:32 - production33 networks:34 - docs_net3536networks:37 docs_net:38EOF3940# 2. Create the .env file41cat > .env << 'EOF'42# MkDocs Material43# Dev server at http://localhost:800044# Build with: docker compose --profile build up45# Production with: docker compose --profile production up46EOF4748# 3. Start the services49docker compose up -d5051# 4. View logs52docker compose logs -fOne-Liner
Run this command to download and set up the recipe in one step:
terminal
1curl -fsSL https://docker.recipes/api/recipes/mkdocs-material/run | bashTroubleshooting
- Build fails with 'Config file not found': Create mkdocs.yml in the ./docs directory with site_name and theme configuration
- Development server shows 'Permission denied' on port 8000: Check if port is already in use or run with different port mapping
- Material theme not loading properly: Verify mkdocs.yml contains 'theme: name: material' and image includes latest Material extensions
- NGINX shows 403 Forbidden on production: Ensure ./site directory exists and contains built files from mkdocs build command
- Search functionality not working: Enable search plugin in mkdocs.yml plugins section and rebuild the site
- Live reload not triggering on file changes: Verify ./docs volume mount path matches your local documentation directory structure
Community Notes
Loading...
Loading notes...
Download Recipe Kit
Get all files in a ready-to-deploy package
Includes docker-compose.yml, .env template, README, and license
Ad Space
Shortcuts: C CopyF FavoriteD Download