Hi everyone ,
I have a little problem with docker-compose.
I want to import data in my mongodb database with a docker-compose but i donโt found a solution. This is an idea that i get somewhere but that does not work. If someone see a better solution or just fix this solution , i take :).
Thank you in advance
./docker-compose.yml
db:
image: mongo
ports:
- 27018:27017
dbseed:
build: ./dbseed
links:
- db
app:
build: .
links:
- db:db
ports:
-8080:8080
-8181:8181
dbseed/new_climat_final.json
[
{
"name": "Joe Smith",
"email": "jsmith@gmail.com",
"age": 40,
"admin": false
},
{
"name": "Jen Ford",
"email": "jford@gmail.com",
"age": 45,
"admin": true
}
]
dbseed/Dockerfile
FROM mongo
COPY new_climat_final.json /new_climat_final.json
CMD mongoimport --host db --db hpApiDev --collection coll --type json --file /new_climat_final.json --jsonArray
No error but no data in my mongodb database