Docker builds LNMP website platform
1 Customizing the Network
[[email protected] ~]# docker network create lnmpecf3266e5d864f09d4a2e258797903d65a2818c7248ff2199f7592a90f3eb76c
2 Creating a MySQL database Container
[[email protected] ~]# docker run -itd --name lnmp_mysql --net lnmp -p 3306:3306 --mount src=mysql-vol,dst=/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mysql --character-set-server=utf8
3 Creating the required database
docker exec lnmp_mysql sh -c ‘exec mysql -uroot -p"$MYSQL_ROOT_PASSWORD" -e"create database wp"‘
4 Creating a PHP environment container
docker run -itd --name lnmp_web --net lnmp -p 88:80 --mount type=bind,src=/app/wwwroot,dst=/var/www/html richarvey/nginx-php-fpm
5 Take WordPress Blog as an example test
wget https://cn.wordpress.org/wordpress-4.7.4-zh_CN.tar.gztar zxf wordpress-4.7.4-zh_CN.tar.gz -C /app/wwwroot
6 Browser Test Access
http://IP:88/wordpress
Docker build LNMP website platform based on WordPress