3、在开发环境中,如果你删除了iptables中的docker链,或者iptables的规则被丢失了(例如重启firewalld),docker就会报iptables error例如:failed programming external connectivity ⋯ iptables: No chain/target/match by that name
1 2 3 4 5 6 7 8 9 10 11 12 13
systemctl restart docker //重启docker服务 再重复 ./docker.run 就ok了 !!!如果遇见其他错误自行google vim /mydata/deploy/nginx/conf.d/test.localhost.com.conf server { server_name test.localhost.com; location / { root /usr/share/nginx/html; } } :wq cd /mydata/deploy/nginx ./docker.run //每次修改配置你都需要重新生成容器,记得把第一行打开 浏览器运行,如果没什么问题 会访问nginx/sites/index.html
} :wq cd /mydata/deploy/nginx ./docker.run vim /mydata/deploy/nginx/sites/index.php <?php echo phpinfo(); chmod 755 /mydata/deploy/nginx/sites/index.php chmod 755 /mydata/deploy/nginx/conf.d/default.conf 此时访问服务器ip/index.php 应该会出现phpinfo的信息
安装MySQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
cd /mydata/deploy/mysql vim docker.run #docker stop mysql && docker rm mysql && \ docker run \ --name mysql \ -p 3306:3306 \ -v /mydata/deploy/mysql/dbdata:/var/lib/mysql \ -e MYSQL_ROOT_PASSWORD=demo123 \ --network mall-net \ -d \ mysql :wq chmod u+x docker.run docker pull mysql ./docker.run
允许外网访问
1 2 3 4 5
docker exec -it mysql bin/bash mysql -u root -p use mysql; grant all privilegeson *.* to'root'@'%'identifiedby'123456'withgrantoption; flushprivileges;