I currently have two containers within a docker-compose. One container runs a mongoDB while the other is running a flask server that uses the mongoDB. I have a problem calling mongodump within the flask server container as that shell doesn’t recognize mongo. How can I access the other container’s shell so I can call mongodump successfully?
Hello and welcome,
why not install mongodump within the Flask-image/container and use this to create the database-dump?
At least that is the way I’ve used to create dumps from PostgreSQL- and MariaDB-databases.
That’s a great idea, I am just unsure how to get mongoDB into the flask container. The flask container is running python 3.6 while the mongo is running a docker image of mongo 3.4. How would I get mongo into the python image container?
I appreciate the help because it got me in the right direction. Unfortunately the install command you used didn’t work for my image of python. (The official python image, version 3.6) But I did end up finding something that worked.
Here are two parts of my dockerfile: FROM python:3.6 ... RUN wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-debian92-x86_64-100.3.1.deb && \ apt install ./mongodb-database-tools-*.deb && \ rm -f mongodb-database-tools-*.deb