docker.recipes

Grav CMS

beginner

Modern flat-file CMS with no database required.

Overview

Grav is a modern flat-file Content Management System built on PHP that stores content in Markdown files instead of a database. Developed by RocketTheme, Grav emerged as a response to the complexity and security vulnerabilities of traditional database-driven CMS platforms like WordPress and Drupal. By eliminating the database layer entirely, Grav offers faster performance, simpler backups, and Git-friendly version control for content management. The LinuxServer.io Grav image provides a containerized environment with proper file permissions and timezone handling, running on Apache with PHP 8.x support. This flat-file architecture makes Grav exceptionally portable and eliminates common database-related issues like connection failures, corruption, or migration complexity. Content creators and developers benefit from Grav's Twig templating engine, extensive plugin ecosystem through GPM (Grav Package Manager), and the ability to edit content directly in Markdown files or through the optional Admin plugin interface.

Key Features

  • Flat-file architecture with Markdown content storage eliminating database dependencies
  • Twig templating engine with flexible theme customization and inheritance
  • GPM (Grav Package Manager) for one-click plugin and theme installation
  • Built-in Markdown Extra support with custom shortcodes and macros
  • Multi-language content support with automatic language detection
  • YAML-based configuration with environment-specific overrides
  • Responsive Admin Panel plugin for content management through web interface
  • Git-friendly content workflow enabling version control for pages and media

Common Use Cases

  • 1Developer portfolios and documentation sites requiring version-controlled content
  • 2Small business websites needing fast loading times without database overhead
  • 3Marketing agencies managing multiple client sites with simplified deployment
  • 4Technical blogs and knowledge bases leveraging Markdown writing workflows
  • 5Prototype and staging environments where database setup adds complexity
  • 6Educational institutions creating course materials with collaborative editing
  • 7Personal blogs and creative portfolios prioritizing simplicity and performance

Prerequisites

  • Docker Engine 20.10+ and Docker Compose V2 for container orchestration
  • Minimum 512MB RAM allocated for PHP processes and file caching
  • Port 8080 available on host system for web interface access
  • Basic understanding of Markdown syntax for content creation
  • Familiarity with YAML configuration files for Grav settings
  • Knowledge of Twig templating for theme customization (optional)

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 grav:
3 image: linuxserver/grav:latest
4 container_name: grav
5 restart: unless-stopped
6 environment:
7 PUID: 1000
8 PGID: 1000
9 TZ: UTC
10 volumes:
11 - grav_config:/config
12 ports:
13 - "8080:80"
14
15volumes:
16 grav_config:

.env Template

.env
1# No database required - flat-file CMS

Usage Notes

  1. 1Docs: https://learn.getgrav.org/
  2. 2Access at http://localhost:8080
  3. 3Install Admin plugin: bin/gpm install admin, then /admin
  4. 4Content stored as Markdown files in user/pages/
  5. 5Flat-file: no database, easy backups, Git-friendly
  6. 6Twig templating, extensive plugin ecosystem

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 grav:
5 image: linuxserver/grav:latest
6 container_name: grav
7 restart: unless-stopped
8 environment:
9 PUID: 1000
10 PGID: 1000
11 TZ: UTC
12 volumes:
13 - grav_config:/config
14 ports:
15 - "8080:80"
16
17volumes:
18 grav_config:
19EOF
20
21# 2. Create the .env file
22cat > .env << 'EOF'
23# No database required - flat-file CMS
24EOF
25
26# 3. Start the services
27docker compose up -d
28
29# 4. View logs
30docker compose logs -f

One-Liner

Run this command to download and set up the recipe in one step:

terminal
1curl -fsSL https://docker.recipes/api/recipes/grav-cms/run | bash

Troubleshooting

  • Permission denied errors accessing /config: Ensure PUID/PGID match host user ownership of mounted volumes
  • Admin plugin not found after installation: Restart container after GPM install to reload plugin cache
  • Pages not displaying after creation: Check YAML frontmatter syntax in Markdown files for parsing errors
  • Slow performance on large sites: Enable Grav caching in system.yaml and consider Redis cache plugin
  • Theme changes not appearing: Clear Grav cache through Admin panel or delete /config/cache directory
  • GPM install failing with network errors: Verify container has internet access and GPM repository is accessible

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