This guide uses Docker Compose to run Grav with the official Docker image.
For Docker installation, see Docker.
Create docker-compose.yml with the official Grav image:
cat <<'YAML' > docker-compose.yml
services:
grav:
image: getgrav/grav:latest
restart: unless-stopped
ports:
- "8080:80"
volumes:
- grav_site:/var/www/html
environment:
- GRAV_SETUP=true
- GRAV_CHANNEL=stable
- GRAV_SCHEDULER=true
- FIX_PERMISSIONS=false
volumes:
grav_site:
YAML
Important: The official Grav image automatically installs Grav on first run.
docker compose up -d
Open http://YOUR-SERVER:8080 to access your Grav site.
If you’re using the image with Admin plugin, access the admin panel at http://YOUR-SERVER:8080/admin and create your admin user.
For production deployments:
latestFIX_PERMISSIONS=true for proper file ownership| Variable | Default | Description |
|---|---|---|
GRAV_SETUP |
true |
Auto-install Grav if empty |
GRAV_CHANNEL |
stable |
stable or beta |
GRAV_SCHEDULER |
true |
Enable scheduler cron |
FIX_PERMISSIONS |
false |
Fix permissions on start |
getgrav/grav:latest - Latest stable (PHP 8.3)getgrav/grav:php8.3 - PHP 8.3getgrav/grav:php8.4 - PHP 8.4getgrav/grav:php8.5 - PHP 8.5| Volume | Purpose |
|---|---|
/var/www/html |
Grav installation and content |
For persistent content, mount the volume to your host:
volumes:
- /path/to/your/grav:/var/www/html
If you have an existing Grav site:
cat <<'YAML' > docker-compose.yml
services:
grav:
image: getgrav/grav:latest
restart: unless-stopped
ports:
- "8080:80"
volumes:
- ./my-grav-site:/var/www/html
volumes:
grav_site:
YAML
Place your Grav files in ./my-grav-site and start the container.
💼 Professional Services: Need expert help with your Grav Docker deployment? We offer consulting, training, and support. Contact our team →