images\cherry_red.png1 Docker的学习-gaogaoTwo
      images\cherry_blue.png1.1 docker常见问题故障
         images\cherry_orange.png1.1.1 docker容器无法远程连接MySQL
      images\cherry_blue.png1.2 Docker基础命令
         images\cherry_orange.png1.2.1 docker logs
         images\cherry_orange.png1.2.2 镜像构建优化
         images\cherry_orange.png1.2.3 network
         images\cherry_orange.png1.2.4 内部安装应用命令
         images\cherry_orange.png1.2.5 docker ps
      images\cherry_blue.png1.3 Docker网络模式
      images\cherry_blue.png1.4 docker compose
         images\cherry_orange.png1.4.1 docker-compose安装
      images\cherry_blue.png1.5 部署Tomcat 运行环境
      images\cherry_blue.png1.6 docker(compose) LNMP环境的部署
      images\cherry_blue.png1.7 docker 搭建部署Redis集群
      images\cherry_blue.png1.8 docker 搭建部署MongoDB集群
         images\cherry_orange.png1.8.1 MongoDB(configsvr)配置服务器
         images\cherry_orange.png1.8.2 MongoDB(shared) 分片初始化操作
         images\cherry_orange.png1.8.3 配置MongoDB(Mongos)路由服务器
         images\cherry_orange.png1.8.4 MongoDB测试集群可用性
      images\cherry_blue.png1.9 docker 搭建部署MySQL主从复用
      images\cherry_blue.png1.10 docker+Keepalived+Nginx高可用
      images\cherry_blue.png1.11 docker+Ansible多节点集群管理
      images\cherry_blue.png1.12 docker(compose)+Zabbix 多节点监控服务
      images\cherry_blue.png1.13 docker 部署文件目录下载
      images\cherry_blue.png1.14 docker
         images\cherry_orange.png1.14.1 docker镜像管理
         images\cherry_orange.png1.14.2 docker容器
         images\cherry_orange.png1.14.3 docker容器高级操作
首先已经准备好了docker(docker-compose)的运行环境


第一步 by https://github.com/gaogaotwo/dockerfiles 下载

images\3-1.png


修改默认的配置
images\3-2.png

images\3-3.png


vim docker-compose.yml

# web server
nginx:
image: nginx:alpine
ports:
- "80:80"
# - "443:443"
volumes:
# app web应用映射地址 需要你自己去修改 并且添加应用
- /gaogaotwo/wwwroot/:/usr/share/nginx/html/
# nginx configs
- /gaogaotwo/docker/nginx/conf.d/:/etc/nginx/conf.d/:ro
# certificates
# - ./server.crt/:/etc/nginx/server.crt:ro
# - ./server.key/:/etc/nginx/server.key:ro
links:
- fpm:__DOCKER_PHP_FPM__

# php-fpm
fpm:
image: php:7.0-fpm
ports:
- "9000:9000"
volumes:
- /gaogaotwo/wwwroot/:/usr/share/nginx/html
# Your php.ini
- /gaogaotwo/docker/php/php.ini-production:/usr/local/etc/php/php.ini:ro
# environment:
# Set your APP env variables here:
# - APP_KEY=
# - DB_HOST=
# - DB_DATABASE=
# - DB_USERNAME=
# - DB_PASSWORD=
links:
- mysql:mysql

# database
mysql:
image: mysql:5.6
ports:
# Allow client to access 3306
- "3306:3306"
volumes:
- /gaogaotwo/docker/mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=123456



在当前文件目录
# docker-compose up -d
images\3-4.png


images\3-5.png

images\3-6.png


#成功


images\3-7.png

#注意默认情况下 nginx容器内是没有default.conf 需要你自己去添加 在/gaogaotwo/docker/nginx/conf.d 添加 xxx.conf 文件
#在 /gaogaotwo/wwwroot/ 添加web应用
#在你映射的目录下添加 xxx.conf文件
images\3-8.png


#default.conf

server {
listen 80;
server_name gaogaotwo;

charset utf-8;
#access_log /var/log/nginx/log/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
#proxy_pass http://gaogaotwo;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#proxy_redirect off;
#proxy_connect_timeout 30;
#proxy_send_timeout 15;
#proxy_read_timeout 15;
}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
images\3-9.png


访问部署成功
images\3-10.png