Notes on migration of Docker DNMP from LNMP WordPress
![Notes on migration of Docker DNMP from LNMP WordPress Notes on migration of Docker DNMP from LNMP WordPress](http://up-free-imgs.azimiao.com/wp-content/uploads/2019/06/dockerlogo-s.jpg)
The whole process of migration
(22:00) - Start
-
File backup ->complete! -
Database backup ->complete! -
SSL certificate backup ->complete! -
Nginx rule backup ->complete!
(22:30) - Bye! CentOS
-
Cloud background login -
Replace the operating system -
Ubuntu 16.04 x64 -
complete
(22:40) - Hello, Docker and my friends
$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" $ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io $ sudo gpasswd -a ${USER} docker # link: https://docs.docker.com/install/linux/docker-ce/ubuntu/
$ curl -L https://github.com/docker/compose/releases/download/1.25.0-rc1/docker-compose- `uname -s`-`uname -m` -o /usr/local/bin/docker-compose $ chmod +x /usr/local/bin/docker-compose $ sudo reboot $ docker-compose -v
$ docker volume create portainer_data $docker run - d - p External port: 9000 - v/var/run/docker.sock:/var/run/docker.sock - v portainer_data:/data portainer/portainer #Browser access ip: external port
(23:25) - Endless upload
-
File backup upload&unzip ->complete! -
Upload ssl certificate ->complete!
(00:50) - Invite God's DNMP
$ git clone https://github.com/yeszao/dnmp.git #Modify configuration file! PHP, MySql, Nginx [certificate, rule, directory, PHP version] # https://github.com/yeszao/dnmp#2%E5%BF%AB%E9%80%9F%E4%BD%BF%E7%94%A8 $ cd dnmp $ cp env.sample .env $ cp docker-compose-sample.yml docker-compose.yml $ docker-compose up
(01:40) - valuable data recovery
-
Establish database and restore backup data ->Finish! -
Create the database account required by WP ->Finish! -
Write a PHP test ->Finish! -
Modify wp-config.php ->Finish!
Note the db_server address: mysql
(2:00) - The website cannot be opened
#nginx error log PHP:Call to undefined function mysql_connect()
docker ps #The php72 container id 3584bcd6a026 was found above docker exec 3584bcd6a026 docker-php-ext-install mysqli docker restart 3584bcd6a026
(2:50) - WP has no permission to upload files?
Failed to create/2019/04/a.png. The parent directory has no write permission
$ ls -l www
$ ps # php user www-data $ chown -R www-data www
(3:45) - Close useless ports and services
FAQ record
-
The permissions of the mapping volume files of the docker host and the container host are not unified
When using the docker run command to run the container, you can specify the running user (uid) and group (uid) through the user parameter, just like the host.
As for docker compose, try to add the user parameter in yml. Packaging is completed, but the container runs for seconds. -
Where is the MySQL address
Every time the container is restarted, the internal IP address may change.
MySQL can be filled in DNMP, or the configuration file can be modified to fix the MySQL container IP.
Comment
Comment area
0F Why change the system? 0F Even put up bad comments on advertisements 0F You're not fast enough. It's best to switch seamlessly I use Ubuntu 16.04+OneinStack. The old machine backs up the WP root directory+database+SSL script, packs it and places it under the WP root directory, waiting for download. The new machine is installed in the same environment (roughly). The backup package on the old WGET machine is hundreds of times faster than the local upload (exaggerated). Then create a new HOST on the new machine (or use the old machine configuration file), open SSL, replace the SSL certificate, decompress the WP to the location, and command to restore the database. phpMyAadmin is no longer required. The database port password is consistent, and the WP configuration does not need to be modified. Then parse and switch the new machine IP, turn off the old machine HTTP service, ping out the new IP, and update a wave of SSL certificates SSH is better than panel. (funny) Docker's advantages do not lie in these aspects~