I've created new Golden Docker image for Ghost Blogging blogging platform.
Ghost environments suggest that it's better to use
production configuration for live environments:
Essentially, production mode gives priority to performance, whereas development mode gives priority to information.
Since the official container for Ghost is fine for running in development mode, but it has some limitation for running in production. That, and the config file doesn't have any easy way to tweak.
Main feature of the Golden Image is to enable the production ready use, with more configuration options1 build in backup and robust releases.
Usage of the image
For quick test, do the following:
docker run --name some-ghost -p 80:2368 -d gold/ghost
It start's new Ghost container and makes it available at http://localhost.
For production you need something more robust.
Production ready example
Let's create Host based volume ghost, that survives updates, and flexible in configuration:
#Prepare host folder to keep Ghost data sudo mkdir -p /var/lib/ghost sudo chown 1000:1000 /var/lib/ghost # Run container docker run --name ghost1 --env-file /etc/default/ghost -p 80:2368 -v /var/lib/ghost:/var/lib/ghost -d gold/ghost npm start --production
This will run ghost in production mode by using host wired volume. Configuration is provided by
/etc/default/ghost. Here an example of configuration file.
# Ghost environment example # Place in /etc/default/ghost GHOST_URL=http://www.example.com MAIL_FROM='"Webmaster" <firstname.lastname@example.org>' MAIL_HOST=mail.example.com PROD_FORCE_ADMIN_SSL=true
Keep in mind you can switch between development and production modes whenever you like by using or not
--production argument. My image uses same database file in both environment.
I prefer to use docker-compose for such use case
ghost: image: gold/ghost:0.7.3 command: npm start --production restart: always ports: - "2368:2368" volumes: - /var/containerdata/ghost/blog/:/var/lib/ghost environment: - GHOST_URL=http://example.com - PROD_FORCE_ADMIN_SSL=true - MAIL_FROM='"Webmaster" <email@example.com>' - MAIL_HOST=mail.example.com - PROD_FORCE_ADMIN_SSL=false
PROD_FORCE_ADMIN_SSL disables https for admin pages, assuming you use it via frontend load balancer like nginx.
Also i prefer to use explicit versions
gold/ghost:0.7.3 to pevent unintended updates.
Currently backups can be done via:
docker run --rm --volumes-from some-ghost -v $(pwd)/backups:/backups gold/ghost /backup.sh
This will place backup file to
$(pwd)/backups directory of the host machine..
For now i've focused on volume on host pattern. In this scenario i have full access to data and configuration, as well restore of backups is not a problem, so this is not included in the image so far.
However i plane to improve the image in sence of
- Backup and restore functions for data-container scenario
- More config option if needed
- Include more UI Themes, to give you more build in flexibility
- Your ideas...