How to create a manually backup for a Ghost Blog

Today I will show you how you can create a manually backup remotely of your database using a docker container of PHPMyAdmin.
Pre requisites:
- Docker installed on your environment (Local).
- Docker Compose installed on your environment (Local).
- A Linux SO. (Windows Powershell also). (Local)
- A Ghost Site (Remote) I will use my own Ghost Blog (https://danfercf.info/).
- Access to server (Ghost Site) port 3306 (Remote).
- User and password for your Mysql Server (Remote).
The remote environment:
Hardware:
- AWS Ec2 instance (Micro) Free tier.
- 1 GB RAM
- Security access enabled for incoming requests (port 3306).
Software:
- Ghost Site: 5.12.0-alpine
- MySQL server: 8.0
- Ngnix: 1.15.12-alpine
- SSL: enabled
After that we can start, we will use a repository with a PHPMyAdmin configured using Docker Compose you can fork the repository and then you can clone it or just copy the configuration in your machine. We'll follow the 2nd option. If you choose the 1st option you can find the repository here https://github.com/danfercf1/docker-examples
The configuration that you need is:
version: '3'
services:
phpmyadmin:
image: phpmyadmin/phpmyadmin:latest
container_name: phpmyadmin
restart: unless-stopped
ports:
- 8090:80
environment:
PMA_HOST: ${PMA_HOST}
You need to create a file called docker-compose.yml using the above configuration.
For example I'm using a folder called Projects in my home folder:
/home/my_user/Projects/example/phpmyadmin/
I will use that folder to create the file, you can use this command to create the file
touch docker-compose.yml
Then you can put the configuration into the file you can use vim or nano
vim docker-compose.yml
After you saved the file you need to create the .env, it is for save the environment variables for the docker container
PMA_HOST=danfercf.info
This is the configuration explanation:
- PMA_HOST: It is the host where is the Mysql server it should be the same that your ghost site on this case it will be danfercf.info, PHPMyadmin will make the connection to this host automatically.
After saved the .env file we can run our PHPMyadmin container, we will use:
docker-compose up
After the command execution we can see something like this:

That's mean that your container is up and ready to use
Regarding the configuration we can access to our PHPMyadmin dashboard accessing the URL: http://localhost:8090
If everything is well you can see the login screen of the manager

There you need to fill the MySQL user and password to access to your MySQL server for your Ghost Site.
After a successful sign in you can see the PHPMyAdmin dashboard

You will continue selecting the database and doing click in the export link

You can choose the Quick export method and then click to go

After that you are able to download a .sql file with all the tables and data for your Ghost site.
Comments ()