docker撰写另一个服务的传递主机地址

时间:2019-05-05 20:37:37

标签: docker nginx docker-compose

我正在努力解决docker-compose的一个简单问题,我正在尝试使用以下docker-compose文件将前端地址传递给我的nginx反向代理:

version: "3"
services:
  timeline-front:
    image: front-timeline
    restart: on-failure
    depends_on:
      - mongo-app
      - keycloak
      - timeline-back
    environment:
      - KEYCLOAK_SERVEUR=blablabla
      - KEYCLOAK_PORT=8080
    networks:
    - timeline-net
    ports:
    - "8081:80"

  nginx-reverse:
    image: nginx
    depends_on:
      - keycloak
      - timeline-front
      - timeline-back
    volumes:
      - ./data/nginx:/etc/nginx/conf.d
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    ports:
      - "80:80"
      - "443:443"
    environment:
      - FRONT_HOST=timeline-front
      - FRONT_PORT=8081
    networks:
      - timeline-net
    command: /bin/bash -c "envsubst < /etc/nginx/conf.d/app.conf > /etc/nginx/conf.d/default.conf && exec nginx -g 'daemon off;'"

  certbot:
    image: certbot/certbot
    networks:
      - timeline-net
    volumes:
      - ./data/certbot/conf:/etc/letsencrypt
      - ./data/certbot/www:/var/www/certbot
    entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"

networks:
   timeline-net:

此刻,我将front_host作为值传递给了我的Nginx

有什么主意吗?

0 个答案:

没有答案