Public | Automated Build

Last pushed: 2 years ago
Short Description
data only container
Full Description

Data Only Container

This is a data-only Docker image. concept in two lines. first line is for running data only container.

$ docker run --name mongo-data jaigouk/data-only-container

And second line is for running mongodb

$ docker run -p 27017 --name mongodb --volumes-from mongo-data mongodb:latest

modify dockerfile and add ssh keys

## Install an SSH of your choice.
ADD /tmp/
RUN cat /tmp/ >> /root/.ssh/authorized_keys && rm -f /tmp/

About Docker Volume

Read this and take a look at Docker Volume Manager

Volumes are not for persitance.

Volumes decouple the life of the data being stored in them from the life of the container that created them. This makes it so you can docker rm my_container and your data will not be removed.

A volume can be created in two ways:

  1. Specifying VOLUME /some/dir in a Dockerfile
  2. Specying it as part of your run command as docker run -v /some/dir

Either way, these two things do exactly the same thing. It tells Docker to create a directory on the host, within the docker root path (by default /var/lib/docker), and mount it to the path you've specified (/some/dir above). When you remove the container using this volume, the volume itself continues to live on.

Basically, since volumes are not yet first-class citizens in Docker they can be difficult to manage. Most people tend to have extra volumes laying around which are not in use because they didn't get removed with the container they were used with.

Building this image

  1. from dockerfile

docker build -t your_name/data-only-container . and then docker push your_name/data-only-container (assumes that you are running boot2docker locally)

  1. from other base image
$ docker run -i -t ubuntu /bin/bash
root@215d2696e8ad:/# sudo apt-get install -y graphviz
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
root@215d2696e8ad:/# exit

$ docker ps -a
CONTAINER ID        IMAGE               COMMAND             CREATED              STATUS                     PORTS               NAMES
215d2696e8ad        ubuntu:14.04        /bin/bash     About a minute ago   Exited

$ docker commit 215d2696e8ad your_name/data-only-container
$ sudo docker push your_name/data-only-container

Using with Mongodb

run the container first docker run --name mongodb-data your_name/data-only-container.

there is db/mongodb.conf file

logpath = /data/log/mongod.log

And in this image's dockerfile has volume.

RUN echo "copy files"
COPY /usr/local/bin/
ADD db /data/db
ADD droneio /data/droneio

VOLUME ["/data"]

So, you can mount this image in other mongodb image as follows.

EXPOSE 27017
EXPOSE 28017

ENTRYPOINT ["mongod", "-f", "/data/db/mongodb.conf"]

And run the mongodb image

cd docker-env-data
docker build -t data .
docker run -d --name data data tail -f /dev/null
docker run -d -p 43153:27017 \
--name "mongo" \
--restart=always \
--volumes-from data \

Usefull resources

Further considerations

ZFS on CoreOS

Sync gateway


Deis is using Ceph. Ceph is a distributed object store and file system designed to provide excellent performance, reliability and scalability.

From coreos-dev google group, I found docker-ceph. And some commits from deis shows how they applied ceph. It seems that docker-ceph can be a good starting point to use it.

Ceph, Docker, Heroku Slugs, CoreOS and Deis Overview

google search results on this subject

Docker Pull Command
Source Repository