Hi everyone,
I’m trying to achieve the following workflow:
- Download a snapshot from our Atlas cluster.
- Restore it into a running container using
mongodb-atlas-local
. - Run a cleanup script to remove sensitive data.
- Commit the running container’s state to a new image.
- Upload the image to ECR so developers can easily start a container with Atlas Search and “safe” production data preloaded.
I’ve managed everything except step 4—I’m struggling to commit the data properly and start a new container from the image.
Currently, I can commit an image with a /dump
directory where developers could manually run mongorestore
, but I’d prefer a cleaner solution where the image already contains the preloaded data.
I understand that MongoDB’s default behavior involves storing data in an automatic volume, which isn’t committed to the image. I’ve also tried copying the data to another directory (e.g., /data/localdb
) before committing, but I run into issues when starting a new container from the image.
Has anyone successfully achieved something similar? Any ideas on how to properly commit the database state into the image?
Thanks!