How To Setup Ghost Blog With docker-compose

Docker-compose and ghost

Ghost is awesome blogging platform! It's slim, fast and beautiful. Docker-compose is great tool to install software and configure it with just one .yml file.
Unfortunately, there are no posts or manuals on how to install Ghost with docker-compose at all!
During installation of this blog, a docker-compose file was created, and I want to share it with you.

Let's start!

First of all, check that docker and docker-compose are installed. The commands below should return you current version of docker and docker-compose installed.

docker -v  
docker-compose -v  

There's a docker image with Ghost on Docker Hub. We'll use it in our docker-compose file.

Create new docker-compose.yml

touch docker-compose.yml  

Copy and paste this template to your docker-compose.yml

version: '2'  
    restart: always
    image: ghost
      - "80:2368"
      - {path_to_save_ghost_data}:/var/lib/ghost

Change {path_to_save_ghost_data} to the path where you want Ghost to store it's files, for example /home/administrator/ghost.

Start your ghost instance.

 docker-compose up -d

Now you can go and check that ghost is running.

Ghost initial page

After Ghost is installed, I'd recommend you to do some fine-tuning, it's optional.

Stop the ghost instance

docker-compose down  

Open ghost config file. It is located in {path_to_save_ghost_data}/config.js in my case it is /home/administrator/ghost/config.js.
Find development section. Yes, development. For some reasons you can not run ghost in production mode with docker (if you find a way to do so, please share it with me).

Set-up your blog url and mail address, the resulting development section should looks like this:

development: {  
        url: '', // your blog url
        mail: {
          from: '', //default from address
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(process.env.GHOST_CONTENT, '/data/ghost-dev.db')
            debug: false
        server: {
            host: '',
            port: '2368'
        paths: {
            contentPath: path.join(process.env.GHOST_CONTENT, '/')

Start Ghost again.

docker-compose up -d  

That's it! Happy blogging in your new shiny blog

Originally posted: