在服务模式下运行Docker容器时-其他容器名称网址停止工作

时间:2020-08-14 23:16:15

标签: docker docker-compose

我已经设置了我的应用docker容器,以使用服务network_mode通过VPN路由流量。效果很好,但是我的“ redis”和“ db” URL不再起作用。关于如何解决此问题的任何想法?

version: '3.3'

services:
  app: 
    build:
      context: .
    environment:
      NODE_ENV: development
      TZ: UTC
      DEBUG: "*:*"
      POSTGRES_URL: postgresql://user:password@db:5432/test
      REDIS_URL: redis://redis:6379
    network_mode: service:openvpn
    depends_on:
      - openvpn
      - db
      - redis
  db:
    image: postgres
    ports:
      - "5432:5432"
    environment:
      POSTGRES_USER: user
      POSTGRES_PASSWORD: password
      POSTGRES_DB: test
  redis:
    image: redis
    ports:
      - "6379:6379"
  openvpn:
    image: kuthz/openvpn-killswitch
    container_name: openvpn
    cap_add:
      - NET_ADMIN
    devices:
      - /dev/net/tun
    volumes:
      - type: bind
        source: ./openvpn-config
        target: /etc/openvpn/profile/

0 个答案:

没有答案