标签:http tools 火墙 soft sys webapps lin pps 基于
[TOC]本文基于Centos 7 环境的docker搭建操作,centos 7 用 firewalld 替换了iptables作为默认防火墙操作,但以前习惯了iptables 就不与时俱进了。
systemctl disable firewalld
systemctl stop firewalld
setenforce 0
sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config
yum install iptables iptables-services net-tools vim
systemctl enable iptables
systemctl start iptables
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 8443 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.203.0/24 -o eth0 -j MASQUERADE
iptables -A FORWARD -s 192.168.203.0/24 -j ACCEPT
iptables-save > /etc/sysconfig/iptables
systemctl restart iptables.service
yum -y install epel-release
yum install -y yum-utils
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce docker-compose
systemctl enable docker
systemctl start docker
docker pull wordpress
docker pull mysql:5.7
### 运行mysql
mkdir -p /opt/data/apps/wordpress/data
chown -R 999:999 /opt/data/apps/wordpress/data
docker run --name mysql -h mysql --restart=always -e MYSQL_ROOT_PASSWORD=1qaz2wsx -v /opt/data/apps/wordpress/data:/var/lib/mysql -v /opt/data/temp:/opt/soft -d mysql:5.7
### 运行wordpress
mkdir -p /opt/data/apps/wordpress/webapps
chown -R 33:33 /opt/data/apps/wordpress/webapps
docker run -h wordpress --name wordpress --restart=always --link mysql:mysql -p 80:80 -v /opt/data/apps/wordpress/webapps:/var/www/html -v /opt/data/temp:/opt/soft -d wordpress
标签:http tools 火墙 soft sys webapps lin pps 基于
原文地址:http://blog.51cto.com/13673090/2177972