docker-compose exec -T <mongodb_service_name> mongodump --archive --gzip --db <mongodb_database> > dump.gz
docker-compose exec -T <mongodb_service_name> mongorestore --archive --gzip < dump.gz
Thank you for this
Howdy! Thank you for this wonderful howto. I'm sure I've used this solution in the past, but suddenly it doesn't work. I have two Docker configurations managed with docker-compose
. I'm trying to dump and restore one database to the other. The docker-compose.yml
settings, etc., are identical:
version: '3'
services:
# ...
mongo:
image: mongo
volumes:
- db_data:/data/db
#...
volumes:
db_data:
At the moment, this is what happens if I execute the instructions you have shared:
2022-05-13T15:04:08.927+0000 Failed: EOF
2022-05-13T15:04:08.928+0000 0 document(s) restored successfully. 0 document(s) failed to restore.
I've tried all manner of trouble-shooting steps found online, but nothing works (--nsInclude
, authentication params, etc.). The best I get is:
2022-05-13T15:24:22.680+0000 error connecting to host: could not connect to server: connection() : auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed.
I know this is an old post, but I would be grateful for any suggestions you might have.
omg!!