/ Ghost

Create your own Ghost blog in a Docker container

Welcome to my first blog post! In the following I'll show you the most easy way of setting up your own Ghost blog in a Docker container.

Getting started

First of all, we need to create a settings file for Ghost in which the URL and paths are configured. Create the file inside a new Ghost folder e.g. located at /var/www/ghostblog/ with the name config.production.json. Then copy and paste the following content:

{
  "url": "https://blog.alexanderschaefer.io/",
  "server": {
    "port": 2368,
    "host": "0.0.0.0"
  },
  "database": {
    "client": "sqlite3",
    "connection": {
      "filename": "/var/lib/ghost/content/data/ghost.db"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file"
    ]
  },
  "process": "systemd",
  "paths": {
    "contentPath": "/var/lib/ghost/content"
  }
}

Furthermore, change the URL setting to the URL of your blog. This url is basically used for back navigation and links in the footer, so it is important to change this setting.

Creating the container

After that, we start the container with the following command:

docker run -d -p 10004:2368 --name ghostblog -v /var/www/ghostblog/content:/var/lib/ghost/content -v /var/www/ghostblog/config.production.json:/var/lib/ghost/config.production.json ghost:1-alpine

Remember to change the path /var/www/ghostblog/ to point to the folder containing your configuration file.
Your blog is now available under somedomain.com:10004!
You can set up a proxy with Apache or Nginx to change the URL of your blog to whatever you want e.g. blog.somedomain.com, there are several well written guides for that on the internet.
To access the admin dashboard of ghost you have to open somedomain.com:10004/admin. The first time you open the page you will be prompted to create an admin account. After that you can write your first post!

That's it! Check out my other guides on how to add a comment section to your blog.

Keep in touch

Thank you for reading! Feel free to comment if you have any questions, ideas or just want to talk to me and remember to check out my other posts.