Hello,
I have installed ghost via Docker, I have set a url and can see it update in the config file. But when a restart the server and goto my site the URL is still as the public IP of the server, this is what I dont want. Thanks for the help!
Hi,
Are you using Docker-compose? if so share your docker-compose.yaml
file
I setup ghost running this command
docker run -d --name ghost -e url=http://localhost:3001 -p 3001:2368 ghost
Thanks
got the issue … its actually not saving any data so when you restart the container all went fresh.
Its better to use docker with Docker Compose
I can provide you a docker-compose file to use for ghost deployment which i use for my own instances
allow me some time i will get back to you with the docker compose file
Thank you so much for the help
You are welcome…
Okay you need to install docker-compose first
sudo apt install docker-compose
now create a folder to contain the docker-compose file for eg myblog
mkdir myblog
now create a file called docker-compose.yaml
inside the folder we created in my case its myblog
nano myblog/docker-compose.yaml
& paste the following to the docker-compose.yaml file
version: '3'
services:
ghost:
container_name: containername
image: ghost:latest
restart: always
ports:
- 3001:2368
volumes:
- ./content:/var/lib/ghost/content
environment:
url: https://yourdomain.com
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: password
database__connection__database: databasename
db:
container_name: dbcontainer_db
image: mysql:5.7
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
volumes:
- ./data:/var/lib/mysql
save the file & dont forget the adjust the values such as containername, url, db container name password etc.
Note: database__connection__password: & MYSQL_ROOT_PASSWORD: has to be same…
now just run the container by following command
docker-compose up -d
with this method you wont loose any data after restarting the container
Hope this helps >
Thanks