本文共 1327 字,大约阅读时间需要 4 分钟。
[TOC]
本文基于Centos 7 环境的docker搭建操作,centos 7 用 firewalld 替换了iptables作为默认防火墙操作,但以前习惯了iptables 就不与时俱进了。
systemctl disable firewalldsystemctl stop firewalldsetenforce 0sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/configyum install iptables iptables-services net-tools vimsystemctl enable iptablessystemctl start iptablesiptables -A INPUT -p tcp --dport 80 -j ACCEPTiptables-save > /etc/sysconfig/iptablessystemctl restart iptables.serviceyum -y install epel-release
yum install -y yum-utilsyum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoyum install -y docker-ce docker-composesystemctl enable docker systemctl start docker docker pull wordpressdocker pull mysql:5.7### 运行mysqlmkdir -p /opt/data/apps/wordpress/datachown -R 999:999 /opt/data/apps/wordpress/datadocker run --name mysql -h mysql --restart=always -e MYSQL_ROOT_PASSWORD=12345678 \-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/webappschown -R 33:33 /opt/data/apps/wordpress/webappsdocker 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
转载于:https://blog.51cto.com/13673090/2177972