nginx 反向代理tomcat3個節點
yaml 文件配置mysql
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