docker compose 部署nginx-tomcat平台
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了docker compose 部署nginx-tomcat平台相关的知识,希望对你有一定的参考价值。
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平台的主要内容,如果未能解决你的问题,请参考以下文章