在CentOS系列系统中可直接使用yum命令进行搜索安装,安装完毕后可运行docker
version查看安装的版本,docker包含了很有公用的镜像,可使用docker search进行搜索安装。
yum install docker -y
docker pull nginx
# 运行4个docker镜像,网站目录在./ningx/html/下,日志文件在 ./nginx/logs/下
docker run -it -p 8081:80 –name nginx1 -v
`pwd`/nginx/html1/:/usr/share/nginx/html/ -v `pwd`/nginx/logs1/:/var/log/nginx/
-d nginx
docker run -it -p 8082:80 –name nginx2 -v
`pwd`/nginx/html2/:/usr/share/nginx/html/ -v `pwd`/nginx/logs2/:/var/log/nginx/
-d nginx
docker run -it -p 8083:80 –name nginx3 -v
`pwd`/nginx/html3/:/usr/share/nginx/html/ -v `pwd`/nginx/logs3/:/var/log/nginx/
-d nginx
docker run -it -p 8084:80 –name nginx4 -v
`pwd`/nginx/html4/:/usr/share/nginx/html/ -v `pwd`/nginx/logs4/:/var/log/nginx/
-d nginx
安装docker php-fpm
docker pull php:7.1-fpm
docker run -p 9000:9000 –name php-fpm1 -d -v
/opt/app/docker/nginx/app1/:/var/www/html:ro php:7.1-fpm
docker run –name nginx1 -p 8081:80 -d -v
/opt/app/docker/nginx/html1:/usr/share/nginx/html:ro -v
/opt/app/docker/nginx/conf1:/etc/nginx/conf.d:ro -v
/opt/app/docker/nginx/logs1:/var/log/nginx –link php-fpm1:php nginx
echo " /opt/app/docker/nginx/app1/index.php