Kingamere
Kingamere

Reputation: 10146

Docker mongodb - how are data only containers portable

How are data only containers portable when they ultimately store data on the host under /var/lib/docker ?

Let's say I have this data container on my machine that stores entries into a database. And now let's say someone else 500 miles away wants to use that data container for his database.

How would I give him the container?

Upvotes: 0

Views: 223

Answers (1)

Rico
Rico

Reputation: 61661

This question is hella broad.

So the Docker images are portable. You can start a container, do a bunch of operations like install packages, start services, modify files and then do a:

docker commit <container-id> myname/containername:version
docker push <image-id>

Then the rest of the world can use your container image if it's pushed to DockerHub. That is if your permissions are public. You can also make your image private so that it can be shared by a select group of people. Another alternative is to setup your own Docker Registry and just push your images to that registry so that it's not widely available to everybody.

If you want to share your data. I don't recommend using Docker images, it's just not what it's meant to be. Say you are using mysql, you can just do a mysqldump of your database and store it in some service like S3 and then shared it to whoever you want so that they can later import the data into their own containers running mysql.

Hope this helps.

Upvotes: 1

Related Questions