Skip to content

Unable to use --volumes-from with an unstarted container made with docker create #8942

@pwaller

Description

@pwaller

Use case

I would like to be able to easily script containers which have long-lived items such as history files or databases in it.

Method

# Once
docker create --name=data-container --volume "/data" scratch -

# Repeatedly
docker run --rm --volumes-from=data-container base <command which messes with /data>

Problem

This almost works, except that data-container must be started once in order for the volume directory to come into existence. Since scratch doesn't have anything in it, it's not possible to start it without error.

Possible solutions

  1. Provide a way to make a container whose purpose is just to have data volumes
  2. OR docker create causes the volume to come into existence immediately
  3. OR docker run ensures that volumes which are defined in containers specified by --volumes-from come into existence before starting.

/cc @drj11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions