Created
September 14, 2016 17:50
-
-
Save jschwarty/6f9907e2871d1ece5bde53d259c18d5f to your computer and use it in GitHub Desktop.
Docker compose for mongodb and seed containers
This file contains hidden or 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: '2' | |
services: | |
mongodb: | |
image: mongo:3.2.6 | |
ports: | |
- "27017:27017" | |
mongo-seed: | |
image: mongo:3.2.6 | |
links: | |
- mongodb | |
volumes: | |
- ./seed-data:/seed-data | |
command: | |
'bash -c "mongoimport --host mongodb --type json --file /seed-data/projects.json --jsonArray"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for gist. I tried your method. But code probably doesn't works because
mongo_seed
cannot reach db frommongo
. As I understandlinks
wait container run, but not prepared db.I created branch for test here
git clone https://github.com/ravecat/mendeleev.git --single-branch --branch issue/seed_mongo_docker_compose
.If I check
docker container logs mongo_seed
I getBut I can run
mongoimport
command from host system and it will be successfully or runmongo
with any custom port (in my examplemongo --port 27019
)Could you clarify that?