Docker and Ghost Logo

Deploy a Ghost Blog with Docker

Ghost and Docker are a powerful combination that can be used to deploy a blog. This article will show you how to deploy a Ghost blog with Docker.

From 0 to blog in under 5 minutes

Docker can be an amazing tool for deploying and managing applications, and can streamline many tasks that used to be tedious and time-consuming. This tutorial will show you how to use set up docker in your local environment to develop a blog application. For this tutorial we will be using as our blog application. Ghost is a free, open-source, and easy-to-use blogging platform with powerful features like real-time search, RSS, and email notifications.

Lets get started

First, we need to install on our local machine. If you don't have docker installed, you can install it with the following command:

Lets break this down a little.

The These commands are necessary to ensure that the system is up to date before installing docker.

Verify the installation

The convenience script automatically installs the latest version of docker compatible with your system. To verify that everything went smoothly, we can run the following command:

This command will try to find the hello-world image locally, if it is unable to do so, the image will be pulled from docker hub. Once the image has completed downloading, the hello-world program will run, printing the following to the terminal:

Success! Docker is installed and running.

Install Ghost

Now that Docker is up and running, we're ready to install our blogging platform. This is where docker really shines, as the install can be as simple as running a single command and utilizing the built-in SQLite database. For larger applications, it is recommended to use a database like MySQL or PostgreSQL, which will allow you to store data in a more robust, secure, and scalable way. For this demonstration, we'll be sticking with SQLite. To get started we'll run the following command:

In this command there are quite a few flags, so we'll go over each in more detail.

We're also specifying an alpine image, which is a lightweight, minimalistic image that is optimized for running Ghost. Once the image has been pulled, it will begin running in the background. You can confirm this with the following command:

after which you should see the following output:

Check it out

At this point, you can access your blog at . If you've never used Ghost before, you'll need to create a new user by visiting and clicking "Create your account". Once you've created your own account, you'll be able return to and log in to the dashboard. To clear out the sample data, you'll need to delete the user "Ghost". To do this, click the cog icon on the bottom left of the page and select "Staff". Select the user "Ghost" and click the cog icon on the top right of the page, then click "Delete User". You'll be prompted to confirm the deletion. Once you've confirmed, you'll have cleared out the sample data and now have a fresh slate to work with!

Make a post

Ghost has made authoring posts amazingly simple. To create a post, simply click the "New Post" button on the dashboard. You'll be greeted by Ghost's new post editor, which gives you a clean interface for Authoring. For this demonstration, we'll just be creating a test post. Input some test data and click "Publish", Ghost will ask if you want to publish now or later. Click "Publish Now" and your post is instantly available. To view your post, click the "View Post" button on the right sidebar.

Check data persistence

Once you are satisfied with the test post, go ahead and stop the docker image by running the following command:

then restart it with the following command:

and visit to see your post. You should be greeted with the test post you created in the previous step. If your post is still there, you've successfully installed Ghost and are ready to go!

If you'd like to learn more about Ghost, check out the , or the .