Site Loader
Get a Quote

If your service needs some files bigger then 100 MB when it is running and you are struggling with your docker container, we have a solution for you, at least it worked for us.

The solution

Do not put a lot of data in the docker volumes. Also, a source control e.g. git or SVN is not the best fit for such artifacts.

It’s fine to have a small amount of data in volumes if it’s essential. For larger datasets, you might want to consider other options.

Attaching volumes for read-only data set completely makes sense, but it becomes tedious if you are running containers on some distributed orchestration tools e.g. Kubernetes, Mesos or ECS.


Example of Read-only Data Sets:
Pre-generated tiles for a map server;
A GeoIP database (mapping IP addresses to geographic information);
Possibly (slow-to-update) search indexes for a significant corpus, like e.g. offline copies of Wikipedia; etc.

But with using volumes, it’s better to decouple the application. use the application in a single container and second container will only keep the data ready.
And with Orchrestation tool, application container can be dependant on the data container.

A binary artifact storage service, like Nexus or Artifactory, is more suited to this task or even you can put the data on S3 and at runtime (using docker entrypoint), data container can copy the data into the local volume from remote source. Keep this separate so it doesn’t need to copy data again and again if application container dies.

Last but not least, start the actual service container, based on the first image, using the data container volumes with the –volumes-from option.

Reference for Beginners

Docker

Docker is a computer program that performs operating-system-level virtualization, also known as “containerization”. It was first released in 2013 and is developed by Docker, Inc.
Docker is used to run software packages called “containers”. Containers are isolated from each other and bundle their own application, tools, libraries and configuration files; they can communicate with each other through well-defined channels. All containers are run by a single operating-system kernel and are thus more lightweight than virtual machines. Containers are created from “images” that specify their precise contents. Images are often created by combining and modifying standard images downloaded from public repositories.

Visit www.docker.com

Post Author: Gohar Sultan

Leave a Reply

Your email address will not be published. Required fields are marked *