Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongorestore in docker failed: Failed: gzip: invalid header

I created a mongo dump with commands (as suggested in this answer)

docker exec -it mongodb bash
mongodump --host $cluster --ssl --username $username --authenticationDatabase admin --db $dbname --gzip --archive > dumpname.gz

Now when I'm trying to restore the dump with

docker exec mongodb bash -c 'mongorestore --gzip --archive=dumpname.gz'

I get

Failed: gzip: invalid header

like image 592
Yurii Avatar asked Sep 03 '25 10:09

Yurii


1 Answers

It seems like there is some bug with using redirection (>). So when I changed the first command to not use it, mongorestore started to work:

mongodump --host $cluster --ssl --username $username --authenticationDatabase admin --db $dbname --gzip --archive=dumpname.gz

Some similar problems could be found here

like image 88
Yurii Avatar answered Sep 05 '25 04:09

Yurii