Deploy ghost blog with docker
Ghost has official docker image. I use it to quick start ghost blog locally for testing purpose. Below is the docker compose file I used. The database is mysql.
version: "3"
services:
ghost:
image: ghost
container_name: ghost
volumes:
- ghostdata:/var/lib/ghost/content
environment:
- url=http://localhost:8081
- database__client=mysql
- database__connection__host=mysql
- database__connection__user=ghost
- database__connection__password=ghostpwdtest
- database__connection__database=ghostdb
ports:
- "8081:2368"
depends_on:
- mysql
restart: unless-stopped
mysql:
image: mysql
container_name: mysql
volumes:
- ghostdb:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=rootpwdtest
- MYSQL_DATABASE=ghostdb
- MYSQL_USER=ghost
- MYSQL_PASSWORD=ghostpwdtest
expose:
- "3306"
restart: unless-stopped
volumes:
ghostdb:
ghostdata:
Start it with command docker-compose up -d
. And then you can visit http://localhost:8081 to view the site and http://localhost:8081/ghost to access the admin portal.