Notes on migration of Docker DNMP from LNMP WordPress

There are more and more programs on the server. What are their commands?
After learning Docker in the company, I found that it is very friendly to people who can't recite orders.
emmm, Throw the program onto Docker!

The whole process of migration

(22:00) - Start

  • File backup ->complete!
  • Database backup ->complete!
  • SSL certificate backup ->complete!
  • Nginx rule backup ->complete!

Everything is ready to migrate the blog.

(22:30) - Bye! CentOS

  • Cloud background login
  • Replace the operating system
  • Ubuntu 16.04 x64
  • complete

In a few seconds, the unique image disappeared in the world. CentOS, bye.

(22:40) - Hello, Docker and my friends

Emmmm, I should be able to sleep before 1 o'clock.

Install Docker CE like this.

 $ 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/

The official warehouse has been added and the latest docker ce has been installed.

Install the latest docker compose!

 $ 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

Install a practical Docker panel

 $ 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

There is no FTPServer for the new machine!
WinSCP is finally connected!
Uploading speed is really slow.
In the file backup, there is the file backup of last month???

  • File backup upload&unzip ->complete!
  • Upload ssl certificate ->complete!

(00:50) - Invite God's DNMP

DNMP is the Docker LNMP one click installation package made by Yeszao.

 $ 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

It's almost two o'clock!?

DNMP comes with phpMyAadmin.

  • 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

I'm sleepy, so I can make a cup of strong coffee.

Browser address bar ->www.azimiao. com ->Enter and complete in one go!
500 Error???

Nginx log:

 #nginx error log PHP:Call to undefined function mysql_connect()

WordPress should not be called on php7.2 mysqli What?
Well, the container is empty mysqli Expansion.

 docker ps #The php72 container id 3584bcd6a026 was found above docker exec 3584bcd6a026 docker-php-ext-install mysqli docker restart 3584bcd6a026

ojbk! Address bar ->www.azimiao. com ->Enter and complete in one go!
Error establishing database connection???

Find the bug
The second cup of coffee
Find the bug

Delete wp-config.php and let wp generate by itself?!

Wp has no permission to create files? Copy manually!

Access succeeded!

(2:50) - WP has no permission to upload files?

Failed to create/2019/04/a.png. The parent directory has no write permission

Enter the php container

 $ ls -l www

Owner uid 1000?

 $ ps # php user www-data $ chown -R www-data www

Upload successful

(3:45) - Close useless ports and services

I'm so sleepy that I can't support it.
In operation
In operation
In operation
Done.

FAQ record

  1. 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.

  2. 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.

Zimiao haunting blog (azimiao. com) All rights reserved. Please note the link when reprinting: https://www.azimiao.com/4873.html
Welcome to the Zimiao haunting blog exchange group: three hundred and thirteen million seven hundred and thirty-two thousand

Comment

*

*

Comment area

  1. Ryoma 06-09 11:31 reply

    Why change the system?

  2. Even put up bad comments on advertisements

  3. 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)

    • hare 06-27 18:19 reply

      Docker's advantages do not lie in these aspects~