

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Volumes
incomplete
2: Run Ghost
incomplete
3: Creating a Website
incomplete
4: Persist
incomplete
5: Persist Quiz
incomplete
6: Delete a Volume
incomplete
7: Clean Up
incomplete
This lesson's interactive features are locked, please to keep using them
Cool, we've got a named volume ready to go. Time to run Ghost in Docker.
Docker hosts an official image for Ghost on Docker Hub.
docker pull ghost
docker run -d \
-e NODE_ENV=development \
-e url=http://localhost:3001 \
-e database__connection__filename=/var/lib/ghost/content/data/ghost-dev.db \
-p 3001:2368 \
-v ghost-vol:/var/lib/ghost/content \
ghost
-d runs the image in detached mode to avoid blocking the terminal.-e NODE_ENV=development sets an environment variable within the container. This tells Ghost to run in "development" mode (rather than "production", for instance)-e url=http://localhost:3001 sets another environment variable, this one tells Ghost that we want to be able to access Ghost via a URL on our host machine.-e database__connection__filename=/var/lib/ghost/content/data/ghost-dev.db puts Ghost's development SQLite database inside the volume so our posts and admin account survive when we replace the container.-p before. -p 3001:2368 does some port-forwarding between the container and our host machine.-v ghost-vol:/var/lib/ghost/content mounts the ghost-vol volume that we created before to Ghost's content directory, /var/lib/ghost/content, to persist its files between runs.Run and submit the CLI tests against http://localhost:3001.