Warm tip: This article is reproduced from stackoverflow.com, please click
gzip mongodb stdout

Mongorestore in docker failed: Failed: gzip: invalid header

发布于 2020-04-15 10:30:36

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

Questioner
Yurii
Viewed
163
Yurii 2020-02-04 04:31

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