docker exec <container_name> sh -c 'mongodump --authenticationDatabase admin -u <DB_USER> -p <DB_PASS> --db <DB_NAME> --archive' > /home/ubuntu/db.dump
docker exec -i <container_name> sh -c 'mongorestore --authenticationDatabase admin -u <DB_USER> -p <DB_PASS> --db <DB_NAME> --archive' < /home/ubuntu/db.dump
Fixing $USER variable