Dockerizing ghost platform ( persistent data )

Ghost is an open source publishing platform which is beautifully designed, easy to use, and free for everyone.

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications, whether on laptops, data center VMs, or the cloud.

So let's Dockerize our Ghost platform . ( Docker host is Debian 8 - )

curl -fsSL | sh

Step 2 - Creating required ghost platform folders on the host :

mkdir -p /var/lib/ghost/content/{data,apps,themes,images}

Step 3 - Editing Ghost config file ( config.js ) 

cd /var/lib/ghost/content/
wget -c 
vim config.example.js 
change the url to your production url , the host to and add paths

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: '',
        mail: {},
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            debug: false

        server: {
            host: '',
            port: '2368'
       paths: {
            contentPath: path.join(__dirname, '/content/')


Step 4: defining ghost Environment File 

vim /etc/default/ghost

#Im using my host ip here instead of my domain name . use your domain name in production.
MAIL_FROM='"Webmaster" <>'

Step 5 : Running our container with our customised environment variables and config.js file . We map /var/lib/ghost/content in our host to /var/lib/ghost in our container so that we never lose data if we destroy container . we publish port 2368 as well . 

 docker run --name myghost --env-file /etc/default/ghost -p 80:2368 -v /var/lib/ghost/content/:/var/lib/ghost -d gold/ghost npm start --production

Step 6 : verification 

docker ps