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
Have you ever wondered what life might be like if the Windows 10 OS somehow had a single folder that… Read More
There could be any number of reasons for needing to flash manufacturer stock OEM firmware on a Samsung Galaxy S9… Read More
Designing e-mail solutions on a large scale can be a complex and costly challenge for a business: you need to… Read More