image courtesy (don’t remember — just downloaded from google)

Docker — Good bye data-only-container pattern!

In past the most recommended approach was to use “data only container” for persistence storage of e.g. databases in docker. The data only container does nothing else except exposing a “data volume”. E.g. once you have run the “data-only-container” then you can link it to other container like this:

docker run --volumes-from data-only-container other-container my-cmd

But as of Docker 1.9.0 there is a new volume api! and now the older “data only container” pattern has been abondened in the favor these new volumes. This new volume api is a better way to achieve end results of the “data only container”. Here is an example:

docker volume create --name helloworld
docker run -d -v helloworld:/container/path/for/mapped/volume image-name command-to-execute

Explore the API documentation to learn more what you can do! Its quite powerful e.g. list volumes, delete volumes, find dangling volumes, etc.


About The Author
Rasheed is TECH Enabler at @RapidStartupStudio. You can connect with him on LinkedIn.

Like what you read? Give Rasheed Amir a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.