Skip to content

Persistent data volumes #111

Closed
Closed

Description

@JeremyGrosser

A lot of applications store nontrivial amounts of data on disk and need it to be persisted outside the scope of the aufs filesystem.

Proposal:

docker run base --bind /path/outside/container:/mnt/path/inside/container /path/to/crazydb

Bonus points if you can use variable substitution in the bind path names eg.

docker run base --bind '/mnt/$Id/mail:/var/spool/mail' /usr/sbin/postfix

Presumably this feature would manifest itself in config.json somewhat like this:

"Mountpoint": {
  "Bind": [
    {"OutsidePath": "/path/outside/container",
     "InsidePath": "/path/inside/container"}
  ]
}

Activity

  1. reopened this on Mar 26, 2013
  2. sa2ajj commented on Mar 26, 2013

    @sa2ajj
    Contributor

    would it be possible to have a some sort of --fstab option that'd result in adding lxc.mount.entry entries in the container's config file??

  3. sa2ajj commented on Mar 26, 2013

    @sa2ajj
    Contributor

    actually, there are two options here:

    • copy the given fstab verbatim and use lxc.mount = option
    • translate the content of the file to corresponding lxc.mount.entry
  4. shykes commented on Mar 26, 2013

    @shykes
    Contributor

    The key principle to keep in mind is that we want to minimize how much the
    container's execution environment depends on the host's.

    On Tue, Mar 26, 2013 at 7:40 AM, Mikhail Sobolev
    [email protected]:

    actually, there are two options here:

    • copy the given fstab verbatim and use lxc.mount = option
    • translate the content of the file to corresponding lxc.mount.entry

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/111#issuecomment-15462016
    .

  5. jpetazzo commented on Mar 27, 2013

    @jpetazzo
    Contributor
    1. Short term.
      The command-line binding proposed by @synack would work great. That would make an easy way to persist data, with minimal "out of docker" instrumentation. My personal taste would be to reverse the args, e.g. dotcloud run base -volume /path/in/container=/path/on/host, but that's just me.
    2. Mid term.
      I don't know what we want in the config.json file. FTR, on the current dotCloud platform (which uses the cloudlets format, this is split between two parts: manifest and config. The manifest is the conceptual equivalent of a class definition. It says "to run this, I need one tcp port for SSH, and another for SQL; and also, /var/lib/mysql should be a persistent volume". The config is the instantiated version, so it tells exactly which port was allocated, which volume was binded, etc.
      It looks like we might have port information in the image json file (to mention "hey, that image exposes a service on port 5432, so by default, dotcloud run should automatically add -p 5432 unless overriden").
      If that's so, it would make sense to also mention which paths are supposed to be volumes, if only for mere introspection purposes.
      Then, if we implement container tagging, it would integrate very neatly to provide persistent data storage. I.E. by default, you get a tmpfs on each volume, but if the container is tagged, then volume foo is bound from e.g. /var/lib/docker/volumes/<containertag>/foo.
    3. Long term.
      I believe that storage providers will be an important feature. It's too early to discuss that in detail I guess; but the idea would be to allow docker to interface with storage systems like LVM, btrfs, iSCSI, NFS, glusterfs, ceph... The scheme used by Xen 3 for network and block devices is not perfect, but it's a good source of inspiration (TL,DR: it allows to specify that e.g. /dev/xvdk should be myiscsi:foobar, and it will offload to a myiscsi script the task of locating foobar and making it available, whatever that means; so it is fairly extendable without touching the core). Of course docker wouldn't implement all those interfaces, but provide something that makes it easy for everyone to hook up whatever they need in the system.
  6. sa2ajj commented on Mar 27, 2013

    @sa2ajj
    Contributor

    (Just for the record) I realized one thing: the bound directory should somehow excluded from what is being tracked as "changes". I am not sure if a straightforward implementation would work right away.

  7. jpetazzo commented on Mar 27, 2013

    @jpetazzo
    Contributor

    That will actually work out of the box—because docker tracks changes by checking the AUFS layer, and a bind mount wouldn't show up in the layer.

  8. tadev commented on Mar 29, 2013

    @tadev

    +1 want

  9. titanous commented on Mar 29, 2013

    @titanous
    Contributor

    👍 I want to see if I can get Ceph running in docker so that I can get docker running on Ceph.

  10. 39 remaining items

  11. shykes commented on Apr 24, 2013

    @shykes
    Contributor

    .. and the design will solve your MTA example, jerome, as well as all those listed in this issue.
    —
    @solomonstre
    @getdocker

    On Wed, Apr 24, 2013 at 4:16 PM, Jérôme Petazzoni
    [email protected] wrote:

    I had an interesting discussion with @mpetazzoni yesterday about a rather
    contrived use-case: using containerization to provide isolated environment
    for remote shell access on a multi-user server.
    Specifically, the concern was to operate the local MTA in a separate
    container, but still deliver mails to e.g. ~/Maildir (per-user).
    The challenge here is "partial volume sharing", i.e. the "shell" containers
    should be given access only to /home/$USERNAME (for a unique $USERNAME),
    while the MTA should be able to access /home/$USERNAME/Maildir (for all
    users of the system).
    On Wed, Apr 24, 2013 at 3:49 PM, Evan [email protected] wrote:

    Another use case for exposing the host file system is for communication
    via Unix Domain Sockets, mqueues, , all which use files as the connection
    point. Or maybe also exposing serial ports in /dev?

    The original proposal at the top of this thread would allow this, however,
    I don't think the "data volumes" spec covers it since it only deals with
    container-to-container bridging and extraction.

    This is concept definitely opposed to @shykes https://github.com/shykescomment regarding repeatability on different hosts. Similarly, what I tried
    to do here with pinning CPUs (#439#439)
    is host-specific, albeit repeatable only if different hosts supports all
    the same key/values. But people who do this would be using some way of
    configuring/maintaining it all (like picking service endpoints
    filepaths/host:port or making sure all processes aren't pinned to the same
    CPU).

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/111#issuecomment-16977366
    .


    Reply to this email directly or view it on GitHub:
    #111 (comment)

  12. creack commented on May 7, 2013

    @creack
    Contributor

    Closed by #376

  13. niclashoyer commented on May 7, 2013

    @niclashoyer

    does the pull request #376 solve the use cases mentioned here? If so, is there any documentation about how to use it?

  14. added a commit that references this issue on Apr 20, 2016
  15. added
    kind/feature
    on Mar 4, 2024
  16. added a commit that references this issue on Aug 8, 2025
  17. added a commit that references this issue on May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/volumeskind/feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions