there are many tutorials for creating new wordpress sites with docker containers such as this one, however there aren’t many for those who already have a site and want to migrate existing wordpress installations to docker containers.
│ ├── conf.d
│ ├── h5bp
│ ├── sites-available
│ ├── sites-enabled
│ └── ssl
│ └── 7.0
│ └── src
│ └── src
use official docker installation or use the code below to install since the version in the standard repo’s are dated.
wget -qo- https://get.docker.com/ | sh #or sudo curl -fssl get.docker.com | sh
first step is to backup your mysql database and tar your wordpress wp-content directory. unlike most db backup tutorials, this creates the database if it does not exist with the -b switch. my wordpress docker image (wp_img) contains the rest of the files of the latest version. this site will help if you don’t have the ability to create a backup but do have the database files.
#backup wordpress db mysqldump -u [user] -p -b -h [hostname] [database] --triggers --routines > ~/wordpress.sql #backup wp-content tar -cvzf ~/wp-content.tar.gz /var/www/html/wp-content #or backup entire site directory tar -cvzf ~/wp-full.tar.gz /var/www/html
from mariadb:10.0 add *.sql /docker-entrypoint-initdb.d/ add *.sh /docker-entrypoint-initdb.d/
the official mariadb/mysql docker images will execute .sh, .sql and .sql.gz files in the containers /docker-entrypoint-initdb.d directory, which contains the wordpress.sql backup file along with any shell scripts.
docker build . -t sysinfo-io:mariadb10.0 docker run -d -e mysql_random_root_password=yes -p 3306:3306 -v /docker/wp_db/var:/var/lib/mysql -v /docker/wp_db/etc:/etc/mysql/conf.d --name wp_db -t sysinfo-io:mariadb10.0
when you're a little too careless about virtualizing your domain controllers, cloning, migrating, backing up and restoring, returning from vacation… Read More
systemd is new service manager for linux. it's a replacement for all previous init systems (sysv/sysvinit & ubuntu's upstart) and… Read More