Docker-compose external_links not able to connect

前端 未结 3 1840
闹比i
闹比i 2021-02-09 14:03

I have a couple of app containers that I want to connect to the mongodb container. I tried with external_links but I can not connect to the mongodb.

I get

3条回答
  •  误落风尘
    2021-02-09 14:57

    Yuva's answer above for the version 2 holds good for version 3 as well.

    The documentation for the external_links isn't clear enough.

    For more clarity I pasted the version 3 variation with annotation

    version: '3'
    
    services:
      app:
        image: training/webapp
        networks:
          - <>
        external_links:
          - postgres:postgres
    
    networks:
      <>:
        external: true
    

提交回复
热议问题