Everett Toews
Everett Toews

Reputation: 10946

How do I use a volume created by the docker volume command?

Using Docker 1.9.1, I can create a volume like so

docker volume create --name minecraft-data

Which works just fine

docker volume inspect minecraft-data
[
    {
        "Name": "minecraft-data",
        "Driver": "local",
        "Mountpoint": "/var/lib/docker/volumes/minecraft-data/_data"
    }
]

Then I tried using that volume with --volumes-from but that didn't work

docker run --detach --interactive --tty \
  --volumes-from minecraft-data \
  -e VERSION=LATEST \
  -e EULA=TRUE \
  -p 25565:25565 \
  itzg/minecraft-server
Error response from daemon: Unable to find a node fulfilling all dependencies: --volumes-from=minecraft-data

How do I use a volume created by the docker volume command?

Upvotes: 2

Views: 455

Answers (1)

VonC
VonC

Reputation: 1323115

The docker volume create man page mentions that you are supppose to use that data volume with a mounted path:

You create a volume and then configure the container to use it, for example:

$ docker volume create --name hello
hello

$ docker run -d -v hello:/world busybox ls /world

The mount is created inside the container’s /world directory.

So you don't need --volumes-from here: you need to create a bind mount

- v minecraft-data:/apath

That will allow your container to access data from the volume container minecraft-data in /apath.

Upvotes: 2

Related Questions