Docker-Compose: Can't Connect to Mongo
The depends_on
section is only for controlling startup order.
A links or networks section is also required to allow the containers to talk to each order.
Update the web
section of the docker-compose.yml file to add the link to the mongo_service
container:
... web: depends_on: - mongo_service links: - mongo_service environment: PYTHONUNBUFFERED: 'true'...
Update
The final RUN instruction will execute at build time. You need to use CMD instead for it to execute at runtime:
CMD curl "mongo_service:27017"