A generalized Docker-based Ghost CMS development environment for local theme development. Clone this repository and start developing your Ghost theme immediately with Docker.
- Ghost 6 Alpine - Latest stable Ghost version
- Hot Reload - Theme changes reload automatically
- SQLite Database - No external database required for development
- Configurable - Easy port and theme name configuration
- Development Mode - Optimized for theme development with disabled security features
- Volume Persistence - Content and database persist between container restarts
- Docker and Docker Compose installed
- Basic knowledge of Ghost theme development
-
Clone this repository:
git clone <repository-url> my-ghost-theme cd my-ghost-theme
-
Configure your setup:
cp .env.example .env
Edit
.env
to set your theme name and port:GHOST_PORT=2368 THEME_NAME=my-awesome-theme
-
Add your theme:
- Place your Ghost theme files in the
./theme/
directory - Or clone an existing theme:
git clone <theme-repo> theme
- Place your Ghost theme files in the
-
Start Ghost:
docker compose up
-
Access Ghost:
- Frontend: http://localhost:2368 (or your configured port)
- Admin: http://localhost:2368/ghost
-
Activate your theme:
- Go to Ghost Admin → Settings → Design → Themes
- Upload/Activate your theme
ghost-docker-theme-development/
├── docker-compose.yml # Docker configuration
├── config.development.json # Ghost development config
├── .env.example # Environment variables template
├── .env # Your environment variables (create from .env.example)
├── .gitignore # Git ignore rules
├── theme/ # Your Ghost theme files go here
│ └── .gitkeep
├── content/ # Ghost content (auto-created, gitignored)
│ ├── data/ # SQLite database
│ ├── images/ # Uploaded images
│ └── ...
└── README.md # This file
Create a .env
file from .env.example
and configure:
GHOST_PORT
- Port to expose Ghost on (default: 2368)THEME_NAME
- Your theme's directory name (default: your-theme)
The config.development.json
file contains Ghost-specific settings for development:
- SQLite database configuration
- Development-friendly security settings
- Logging configuration
- Mail transport disabled for development
# Start Ghost in foreground (see logs)
docker compose up
# Start Ghost in background
docker compose up -d
# Stop Ghost
docker compose down
# View logs
docker compose logs -f ghost
# Restart Ghost (useful after theme changes that require restart)
docker compose restart ghost
# Remove containers and volumes (fresh start)
docker compose down -v
- Make theme changes - Edit files in
./theme/
- Automatic reload - Ghost detects changes and reloads
- Manual refresh - Refresh browser to see template changes
- Full restart - Some changes (like routes.yaml) require
docker compose restart ghost
- CSS/JS changes: Automatic reload, refresh browser
- Handlebars template changes: Refresh browser required
- New files or routes.yaml: Full Ghost restart required
Your theme should follow the standard Ghost theme structure:
theme/
├── index.hbs # Homepage template
├── post.hbs # Post template
├── page.hbs # Page template
├── author.hbs # Author template
├── tag.hbs # Tag template
├── package.json # Theme metadata
├── assets/ # CSS, JS, images
│ ├── css/
│ ├── js/
│ └── images/
└── partials/ # Reusable template parts
├── navigation.hbs
└── ...
If your theme uses build tools (Gulp, Webpack, etc.):
- Install dependencies in the theme directory
- Run build commands as needed
- Ensure built files are in the correct locations for Ghost
If port 2368 is already in use:
- Change
GHOST_PORT
in your.env
file - Restart with
docker compose down && docker compose up
- Check that your theme files are in
./theme/
- Activate the theme in Ghost Admin → Settings → Design
- Ensure theme has required files (
index.hbs
,package.json
)
The Ghost container runs as user node
(UID 1000). If you encounter permission issues:
sudo chown -R 1000:1000 ./theme ./content
To start with a fresh database:
docker compose down -v
docker compose up
Check logs for detailed error information:
docker compose logs ghost
Modify config.development.json
for advanced Ghost configuration options like:
- Database settings
- Mail configuration
- Logging levels
- Custom paths
To work with multiple themes, either:
- Change
THEME_NAME
in.env
and swap theme directories - Create multiple Docker compose setups with different configurations
Feel free to submit issues and enhancement requests!
This Docker setup is provided as-is for development purposes.