如何用docker 部署lnmp环境?

前提:安装好了docker -ce 。
systemctl start docker
systemctl enable docker
iptables -X
iptables -F
service iptables save

1、部署nginx:

docker run -it -d -p 80:80 -v /usr/share/nginx/html/:/usr/share/nginx/html/ -v /etc/nginx/conf.d/:/etc/nginx/conf.d/ --name nginx liuxianhuacn/nginx_by_dk:20181230 /bin/bash

docker update --restart=always liuxianhuacn/nginx_by_dk:20181230
2、部署 php-fpm:

docker run -it -d -p 9000:9000 -v /usr/share/nginx/html/:/usr/share/nginx/html/ --name php-fpm liuxianhuacn/php-fpm_by_dk --privileged=true /bin/bash

docker update --restart=always liuxianhuacn/php-fpm_by_dk
3、部署mysql:

docker run -it -d -p 3306:3306 -v /usr/share/mysql:/usr/share/mysql -e MYSQL_ROOT_PASSWORD=123456 --name mysql liuxianhuacn/mysql_install_by_dk:20181230 /bin/bash

docker update --restart=always liuxianhuacn/mysql_install_by_dk:20181230

你可能感兴趣的:(nginx,docker,linux,mysql,lnmp)