docker.recipes

Ghost Blog

beginner

Modern publishing platform for blogs and newsletters.

Overview

Ghost is a modern, open-source publishing platform designed specifically for creators, bloggers, and businesses who want professional publishing capabilities without WordPress complexity. Born from a Kickstarter campaign in 2013, Ghost focuses exclusively on content creation, offering a clean writing experience with built-in membership systems, newsletter functionality, and monetization tools. Unlike traditional CMS platforms that try to do everything, Ghost excels at one thing: helping creators build sustainable publishing businesses. This Ghost and MySQL stack creates a powerful publishing environment where Ghost handles content creation, membership management, and newsletter distribution while MySQL provides reliable, high-performance data storage. MySQL's proven track record with content management systems makes it ideal for Ghost's post storage, member databases, and subscription tracking. The combination offers professional publishing features typically found in expensive SaaS platforms while maintaining complete control over your content and subscriber data. Content creators, newsletter publishers, membership site operators, and businesses building thought leadership platforms will find this stack particularly valuable. Ghost's built-in Stripe integration enables immediate monetization through paid memberships, while its headless API allows custom front-end development. This setup provides the perfect balance between powerful publishing features and technical flexibility, making it suitable for everything from personal blogs to enterprise content marketing platforms.

Key Features

  • Built-in membership system with subscription tiers and payment processing via Stripe
  • Native email newsletter functionality with subscriber management and analytics
  • SEO-optimized publishing with automatic meta tags, structured data, and sitemap generation
  • Modern Ghost Editor with Markdown support and rich media embedding
  • Content API for headless CMS functionality and custom front-end development
  • MySQL 8.0 InnoDB storage with ACID compliance for data integrity
  • Professional theme system with customizable designs and responsive layouts
  • Advanced analytics and member engagement tracking

Common Use Cases

  • 1Professional bloggers monetizing content through paid memberships and newsletters
  • 2Small businesses building thought leadership and customer engagement platforms
  • 3Newsletter publishers migrating from services like Substack or ConvertKit for more control
  • 4Content creators needing both public blog and private member-only content areas
  • 5Marketing teams managing company blogs with multiple authors and editorial workflows
  • 6Developers building custom publishing platforms using Ghost's Content API
  • 7Membership sites offering premium content and community features

Prerequisites

  • Minimum 1GB RAM recommended for Ghost and MySQL combined operation
  • Docker and Docker Compose installed with support for multi-container networking
  • Port 2368 available for Ghost web interface access
  • Valid domain name and SSL certificate for production newsletter and membership features
  • SMTP service configured for Ghost email functionality (newsletters, member invitations)
  • Basic understanding of Ghost admin interface and MySQL database concepts

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 ghost:
3 image: ghost:5-alpine
4 container_name: ghost
5 restart: unless-stopped
6 environment:
7 url: ${GHOST_URL}
8 database__client: mysql
9 database__connection__host: mysql
10 database__connection__user: ${MYSQL_USER}
11 database__connection__password: ${MYSQL_PASSWORD}
12 database__connection__database: ${MYSQL_DATABASE}
13 volumes:
14 - ghost_content:/var/lib/ghost/content
15 ports:
16 - "2368:2368"
17 depends_on:
18 - mysql
19 networks:
20 - ghost-network
21
22 mysql:
23 image: mysql:8.0
24 container_name: ghost-mysql
25 environment:
26 MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
27 MYSQL_DATABASE: ${MYSQL_DATABASE}
28 MYSQL_USER: ${MYSQL_USER}
29 MYSQL_PASSWORD: ${MYSQL_PASSWORD}
30 volumes:
31 - mysql_data:/var/lib/mysql
32 networks:
33 - ghost-network
34
35volumes:
36 ghost_content:
37 mysql_data:
38
39networks:
40 ghost-network:
41 driver: bridge

.env Template

.env
1GHOST_URL=http://localhost:2368
2MYSQL_ROOT_PASSWORD=rootpassword
3MYSQL_DATABASE=ghost
4MYSQL_USER=ghost
5MYSQL_PASSWORD=changeme

Usage Notes

  1. 1Docs: https://ghost.org/docs/
  2. 2Access at http://localhost:2368, admin at http://localhost:2368/ghost
  3. 3Set GHOST_URL to your domain for production links
  4. 4Built-in newsletter, membership, and Stripe payments
  5. 5Themes in /var/lib/ghost/content/themes
  6. 6Ghost(Pro) alternative with self-hosted control

Individual Services(2 services)

Copy individual services to mix and match with your existing compose files.

ghost
ghost:
  image: ghost:5-alpine
  container_name: ghost
  restart: unless-stopped
  environment:
    url: ${GHOST_URL}
    database__client: mysql
    database__connection__host: mysql
    database__connection__user: ${MYSQL_USER}
    database__connection__password: ${MYSQL_PASSWORD}
    database__connection__database: ${MYSQL_DATABASE}
  volumes:
    - ghost_content:/var/lib/ghost/content
  ports:
    - "2368:2368"
  depends_on:
    - mysql
  networks:
    - ghost-network
mysql
mysql:
  image: mysql:8.0
  container_name: ghost-mysql
  environment:
    MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
    MYSQL_DATABASE: ${MYSQL_DATABASE}
    MYSQL_USER: ${MYSQL_USER}
    MYSQL_PASSWORD: ${MYSQL_PASSWORD}
  volumes:
    - mysql_data:/var/lib/mysql
  networks:
    - ghost-network

Quick Start

terminal
1# 1. Create the compose file
2cat > docker-compose.yml << 'EOF'
3services:
4 ghost:
5 image: ghost:5-alpine
6 container_name: ghost
7 restart: unless-stopped
8 environment:
9 url: ${GHOST_URL}
10 database__client: mysql
11 database__connection__host: mysql
12 database__connection__user: ${MYSQL_USER}
13 database__connection__password: ${MYSQL_PASSWORD}
14 database__connection__database: ${MYSQL_DATABASE}
15 volumes:
16 - ghost_content:/var/lib/ghost/content
17 ports:
18 - "2368:2368"
19 depends_on:
20 - mysql
21 networks:
22 - ghost-network
23
24 mysql:
25 image: mysql:8.0
26 container_name: ghost-mysql
27 environment:
28 MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
29 MYSQL_DATABASE: ${MYSQL_DATABASE}
30 MYSQL_USER: ${MYSQL_USER}
31 MYSQL_PASSWORD: ${MYSQL_PASSWORD}
32 volumes:
33 - mysql_data:/var/lib/mysql
34 networks:
35 - ghost-network
36
37volumes:
38 ghost_content:
39 mysql_data:
40
41networks:
42 ghost-network:
43 driver: bridge
44EOF
45
46# 2. Create the .env file
47cat > .env << 'EOF'
48GHOST_URL=http://localhost:2368
49MYSQL_ROOT_PASSWORD=rootpassword
50MYSQL_DATABASE=ghost
51MYSQL_USER=ghost
52MYSQL_PASSWORD=changeme
53EOF
54
55# 3. Start the services
56docker compose up -d
57
58# 4. View logs
59docker 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/ghost-blog/run | bash

Troubleshooting

  • Ghost shows database connection errors: Verify MYSQL_USER and MYSQL_PASSWORD environment variables match between services and that MySQL container is fully initialized before Ghost starts
  • Newsletter emails not sending: Configure proper SMTP settings in Ghost admin panel under Settings > Labs > Email, as Ghost requires external SMTP service for email delivery
  • Ghost admin redirects to wrong URL: Set GHOST_URL environment variable to match your actual domain, including protocol (http/https) and port if non-standard
  • Membership signup failures: Ensure GHOST_URL is set correctly and Stripe webhooks are configured if using paid memberships, as Ghost validates URLs during payment processing
  • MySQL container fails to start with permission errors: Check that the mysql_data volume has proper permissions and isn't conflicting with existing MySQL installations on the host

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