Docker-Compose File for Ghost

Launch Ghost with One Docker Command

Get started with Ghost, the simple publishing platform

Ghost logoGhost is a lightweight, open source blogging platform that’s giving WordPress a run for its money. It’s gaining popularity especially with technical bloggers who prefer to format their posts with Markdown just like on Github. Compared to WordPress’ dashboard with many toggles and switches to customize your theme, Ghost’s template format is aimed at publishers who are comfortable with customizing their layout using code. To get started, you can download free and paid Ghost themes from the Open Marketplace.

Ghost running in Docker

Over the years, WordPress has become a CMS that tries to cater to every need, from an individual blog to a corporate website with many sections and different page styles. A lot of the functionality is bolted on with plug-ins, that can convey an inconsistent user experience and pose a security risk when not updated. Ghost tries to get away from this with a clean and simple UI, and by building features like SEO and social right into the core. If you or your team has ever written on Medium, you’ll likely feel right at home with a Ghost website.

For a comparison of Ghost vs. WordPress, refer to https://ghost.org/vs/wordpress/.

Using the Docker Compose file below, you can immediately bring up an instance of Ghost secured with a TLS certificate issued by Let’s Encrypt. One of the easiest ways to spin up an inexpensive VPS for your Docker host is with DigitalOcean, where a 512 MB “droplet” starts at $5 a month. If you use this referral link, you’ll be given $10 credit to get started.

Usage

Please note: These environment variables should be edited before using the YAML file.

db

  • MYSQL_ROOT_PASSWORD MySQL root password
  • MYSQL_PASSWORD MySQL regular user password

ghost

  • database__connection__password should match MYSQL_PASSWORD
  • VIRTUAL_HOST comma separated list of domains and sub-domains
  • LETSENCRYPT_HOST should match VIRTUAL_HOST
  • LETSENCRYPT_EMAIL contact email for Let’s Encrypt

wget -O docker-compose.yml https://gist.githubusercontent.com/autoize/b2082141f4642dedce9553a6c3dc0dcb/raw/c1efc03fb7880c2467a17e8d053c78eb5a83d9e3/docker-compose.yml

docker-compose up -d

Allow a few minutes for docker-compose to launch all the containers and generate the DH and private keys for TLS. Once finished, visit example.com/ghost to create a user account for yourself and your team members if applicable. Happy blogging with Ghost!