码迷,mamicode.com
首页 > 其他好文 > 详细

docker compose 部署nginx-tomcat平台

时间:2018-05-10 11:36:18      阅读:605      评论:0      收藏:0      [点我收藏+]

标签:compose

nginx 反向代理tomcat3个节点
yaml 文件配置

version: ‘3‘
services:
  nginx:
    hostname: nginx
    build:
      context: ./nginx
      dockerfile: Dockerfile
    ports:
      - 80:80
    links:
      - tomcat01:tomcat01
      - tomcat02:tomcat02
      - tomcat03:tomcat03
    volumes:
      - ./webapps:/opt/webapps
    depends_on:
      - mysql
      - tomcat01
      - tomcat02
      - tomcat03

  tomcat01:
    hostname: tomcat01
    build: ./tomcat
    links:
      - mysql:mysql-db
    volumes:
      - ./webapps:/usr/local/apache-tomcat-8.0.46/webapps

  tomcat02:
    hostname: tomcat02
    build: ./tomcat
    links:
      - mysql:mysql-db
    volumes:
      - ./webapps:/usr/local/apache-tomcat-8.0.46/webapps

  tomcat03:
    hostname: tomcat03
    build: ./tomcat
    links:
      - mysql:mysql-db
    volumes:
      - ./webapps:/usr/local/apache-tomcat-8.0.46/webapps

  mysql:
    hostname: mysql
    image: mysql:5.6
    ports:
      - 3306:3306
    volumes:
      - ./mysql/conf:/etc/mysql/conf.d
      - ./mysql/data:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: 123456
      MYSQL_DATABASE: db
      MYSQL_USER: user
      MYSQL_PASSWORD: user123

docker compose 部署nginx-tomcat平台

标签:compose

原文地址:http://blog.51cto.com/1014810/2114707

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!