Containerizing My WordPress Blog: Part 2 – Exporting the Live Site

These are my notes, to help remind me what I did….

The goal

Get everything out of the live WordPress install and into a staging directory that Docker can work with. Nothing here touches the live site. It’s all copies.

Create the project directory

mkdir -p ~/wp-docker/db-init ~/wp-docker/wp-content
cd ~/wp-docker

Get the config files in place

I had docker-compose.yml, env.example, and php-uploads.ini on my local machine. Transferred them via scp:

scp * user@173.255.253.123:~/wp-docker/.

Export the database

MySQL 8 requires --no-tablespaces when dumping as a non-root user. First attempt without it errored out. This is the command that worked:

mysqldump --no-tablespaces -u johnny -p wordpress > ~/wp-docker/db-init/site-backup.sql

Copy wp-content

cp -a /var/www/html/johnnycarlos.com/public_html/wp-content/. ~/wp-docker/wp-content/

Cleaned up a stray debug.log that came along:

rm ~/wp-docker/wp-content/debug.log

End state

~/wp-docker/
├── docker-compose.yml
├── env.example
├── php-uploads.ini
├── db-init/
│   └── site-backup.sql
└── wp-content/
    ├── plugins/
    ├── themes/
    ├── uploads/
    └── upgrade/


Posted

in

,

by

Tags: