docker的安装
yum install -y docker
启动docker服务并设置为开机自启动
systemctl start docker
systemctl enable docker
镜像下载
下载nginx的镜像
docker pull nginx
下载mysql的镜像
docker pull mysql
下载php的镜像
docker pull php:7.1.0-fpm
编写生成nginx容器脚本并启动脚本
[root@localhost ~]# vim docker_nginx.sh
#!/usr/bin bash
docker run -p 80:80 --name nginx \
-v /docker/code:/usr/share/nginx/html \
-v /var/log/nginx:/var/log/nginx \
-v /docker/nginx/conf.d:/etc/nginx/conf.d \
--privileged=true \
-d nginx
[root@localhost ~]# sh docker_nginx.sh
WARNING: IPv4 forwarding is disabled. Networking will not work.
解决报错
vim /usr/lib/sysctl.d/00-system.conf
# Kernel sysctl configuration file
#
# For binary values, 0 is disabled, 1 is enabled. See s