Ghost docker setup
A quick setup of a docker container to start a blog with Ghost

So here I am a year later after I setup the blog without writing anything in it. Lol!
I am doing some maintenance and I see a few errors in the logs.
I fiddle with it and I make it worse.
So I google a bit and find this article that helped me when started with last year.
I and update things but it still doesn't work. I get some weird errors starting with the Sendgrid API and something about MySql 8 not wanting to use some data folder that was newer than the engine.
So I wipe (again) and start fresh.
Finally I get it right.
Here is my docker compose file. Let's call it a "stack" since I will modify it in Portainer:
version: '3'
services:
ghost:
container_name: blog
image: ghost:latest
restart: always
ports:
- 2368:2368
volumes:
- ./content:/var/lib/ghost/content
environment:
url: https://blog.demir.link
# NODE_ENV: development
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: some_random_password
database__connection__database: /opt/ghost
mail__transport: SMTP
mail__from: "Your Name <yourname@domain.com>"
mail__options__host: "smtp.sendgrid.net"
mail__options__port: 587
mail__options__auth__user: "apikey"
mail__options__auth__pass: "the_long_string_you_get_as_a_key"
db:
container_name: blog_db
image: mysql:8.1
command: mysqld --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: same_random_password
volumes:
- ./data:/var/lib/mysql
Please note I have a commented line in the compose file, to make sure I start the container in development mode. Once the actual blog is up I commented out the line about
NODE_ENV: development
Of course, you have to have your domain setup - I have mine with Nginx Proxy Manager - and the setup with Sendgrid - the part with the authentication of the domain is important.
Let me know if you find errors