$ docker pull harenome/ghost:0.5.1
$ docker run -i -t -p 2398:2368 ghost:0.5.1
The startup script will check whether the following files or directories exist:
/data/config.js
/data/content/apps
/data/content/data
/data/content/images
/data/content/themes
The existing files and directories will be used, otherwise, Ghost will fallback to the default paths.
If your distribution runs SELinux, you may need to use the following command in order to mount volumes in your docker images:
$ chcon -Rt svirt_sandbow_file_t <your_directory>
Assuming your_directory_of_choice
contains:
config.js
: the configuration filecontent
content/apps
: (not used in current versions of Ghost...)content/data
: the location for data (blog posts, settings, etc.)content/images
: the location for imagescontent/themes
: the location for themes
$ cd <your_directory_of_choice>
$ docker run -i -t -v $(pwd):/data -p 2368:2368 ghost:0.5.1
$ cd example
$ docker run -i -t -v $(pwd):/data -p 2368:2368 ghost:0.5.1
To clean the example:
$ git reset --hard && git clean -f
It is also possible to only mount specific files or directories. For instance:
$ docker run -i -t -v <your_config>:/data/config.js -p 2368:2368 ghost:0.5.1
$ docker run -i -t -v <your_config>:/data/config.js <your_data>:/data/content/data -p 2368:2368 ghost:0.5.1
NODE_ENV
NODE_VERSION
(inherited from the OfficialNodeImage(official Node.js build))GHOST_VERSION
2368
/data
The latest
branch is for latest
. Checkout the appropriate branch if
you are looking for the Dockerfile for a specific version of Ghost.
Why not use DockerfileGhost?
The dockerfiles from the DockerfileProject are fine, but most of them use versions dubbed “latest” instead of building against specific versions.
Building Docker images against the latest versions of softwares is fine, as long
as the version is correctly targeted: if the current latest version of a software
is 1.9, use software-1.9
instead of software-latest
. This way, the
Docker images are immune to unexpected new releases (software-latest
shifting
from software-1.9
to software-2.0
...).