I have several application containers that I want to connect to the mongodb container. I tried with external_links, but I cannot connect to mongodb.
I get
MongoError: Could not connect to server [mongodb: 27017] on first connection
Do I need to add containers to the same network to work with external_references?
MongoDB:
version: '2' services: mongodb: image: mongo:3.4 restart: always ports: - "27017:27017" volumes: - data:/data/db volumes: data:
applications:
version: '2' services: app-dev: restart: Always build: repository/ ports: - "3000:80" env_file: - ./environment.env external_links: - mongodb_mongodb_1:mongodb
Networks:
# sudo docker network ls NETWORK ID NAME DRIVER SCOPE 29f8bae3e136 bridge bridge local 67d5519cb2e6 dev_default bridge local 9e7097c844cf host host local 481ee4301f7c mongodb_default bridge local 4275508449f6 none null local 873a46298cd9 prod_default bridge local
source share