- No need for a dedicated network: docker compose autmatically sets one up for you
- No need to export MongoDB's port: you can access it via
docker exec -it test_mongodb_1 mongo
Created
December 15, 2018 21:33
-
-
Save mwmahlberg/c92936555bfa92191c25cf6972257726 to your computer and use it in GitHub Desktop.
Simplified docker-compose for https://stackoverflow.com/questions/53793868/how-to-connect-to-mongodb-container-with-golang-web-app-inside-at-another-contai
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
mongodb: | |
image: mongo | |
volumes: | |
- mongodata:/data/db | |
microservice: | |
depends_on: | |
- mongodb | |
build: . | |
image: cloud-native-go:v1 | |
environment: | |
- PORT=9090 | |
ports: | |
- 9090:9090 | |
volumes: | |
mongodata: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment