I have a working Mongo DB Container called xyz from official Mongo Image. I created a container with docker run -d -p 21707:21707 mongo
In this container I created 2 collections with sample data.
Now I want to extract this container to a new image on dockerhub.
I used docker commitand created a new image, clicked it on the docker hub. If I pull out the image on another system and create a new container from this image, there is no data in my original xyz container.
After researching, I found out that a mango image can be used with a volume, but I skipped this step in the past ... I think that using the / data / db container as a standard volume ( docker inspect), to fix this volume is not tied to a new image? !
I also tried docker export/importwith the same problem mentioned above!
Now my question is, how can I achieve the migration of this "xyz" container with my data samples in a new image / container? Many thanks!
immae source
share