A step-by-step beginner-friendly guide to setting up and deploying Grav CMS using docker-lamp-grav on Linux VPS, macOS, and Windows environments.
Welcome to this comprehensive, step-by-step guide! In this tutorial, we will walk you through deploying Grav CMS using the official open-source repository milkboyinchina/docker-lamp-grav across Linux VPS, macOS, and Windows.
Whether you are launching a cloud production server, local macOS development machine, or Windows workstation, containerizing your LAMP stack with Docker ensures consistent runtime environments, instant rollbacks, and effortless deployment.

Before diving into container deployment, ensure your host environment meets the baseline specs:
22 (SSH), 80 (HTTP), and 443 (HTTPS) open.Run the official convenience script to install Docker CE and the Docker Compose plugin:
# Update packages & install Docker engine
sudo apt update && sudo apt upgrade -y
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo systemctl enable --now docker
.dmg file and drag Docker.app into your Applications folder.docker --version
docker compose versionwsl --installdocker --version
docker compose version
Next, clone the repository milkboyinchina/docker-lamp-grav onto your machine:
# Clone the repository into your workspace
git clone https://github.com/milkboyinchina/docker-lamp-grav.git docker-lamp-grav
# Navigate into the project folder
cd docker-lamp-grav
The repository structure contains pre-configured container definitions for:
mod_rewrite enabled for Grav URL routing.gd, zip, mbstring, curl, xml).While this stack comes pre-configured for Grav CMS, the underlying Apache 2.4 + PHP 8.3 FPM + Docker Compose architecture makes docker-lamp-grav a versatile foundation for any modern PHP application or framework:
src/ directory, add a MariaDB/MySQL container to docker-compose.yml, and complete the setup wizard.src/, set Apache's DocumentRoot to src/public, and run your Artisan migrations.gd, mbstring, zip, xml, opcache) provide out-of-the-box support for Drupal, Symfony, and CodeIgniter projects.Copy the example environment file and set up your domain and directory permissions:
# Copy example environment configuration
cp .env.example .env
# Adjust file ownership for the Web server user (www-data) on Linux/macOS
sudo chown -R 33:33 src/user src/logs src/cache
If you wish to customize port bindings or environment settings, edit .env:
nano .env
Build and launch the containerized stack in background detached mode (-d):
# Launch Docker LAMP Grav stack
docker compose up -d --build
Check the status of the running containers:
docker compose ps

http://localhost/ or http://YOUR_SERVER_IP/Here are handy commands for managing your Grav Docker server across platforms:
# View live container logs
docker compose logs -f
# Clear Grav cache from host
docker compose exec web php bin/gpm clear-cache
# Restart container stack
docker compose restart
Congratulations! You now have a high-performance, containerized Grav CMS instance running smoothly on Linux, macOS, or Windows.