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
- Provide a way to make a container whose purpose is just to have data volumes
- OR
docker create causes the volume to come into existence immediately
- OR
docker run ensures that volumes which are defined in containers specified by --volumes-from come into existence before starting.
/cc @drj11