Add private space ip on docker to mongo atlas ip allowed list

I have a private docker container on my testing space (with model and fast api). I also have a cluster on Mongo DB Atlas where I want to save my data after testing. The problem arises when I want to reset my data from the model on porstores to mongo, then I need to allow access to the current IP (from the space container), but as I understand it, it is dynamic. The problem can be solved by adding 0.0.0.0 to the mongo cluster of allowed IPs, but it will not work for production, because access will be allowed from all IPs. How do I solve this problem? Is it also possible to add a range of addresses in CIDR notation to the mongodb atlas (does this work as a private storage on spaces)?