Compose: Set volume name

Created on 14 Jul 2016  Â·  7Comments  Â·  Source: docker/compose

Hello,
can I set the volume name if I also use a volume driver? I need to set the volume name to something like vol1 for convoy. If that's not possible with compose, please make it a feature request.

docker-compose up
Creating postgresqlconvoy_postgres_data_1

ERROR: for postgres_data  Failed to execute: mount [/dev/mapper/postgresqlconvoy_vol1 /var/lib/rancher/convoy/devicemapper/mounts/postgresqlconvoy_vol1], output mount: wrong fs type, bad option, bad superblock on /dev/mapper/postgresqlconvoy_vol1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
, error exit status 32
ERROR: Encountered errors while bringing up the project.
Makefile:22: recipe for target 'run' failed
make: *** [run] Error 1
version: '2'

services:
  postgres_data:
    image: erwinnttdata/postgresql:latest
    restart: "no"
    command: "true"
    volumes:
      - "vol1:/var/lib/postgresql/data"
    volume_driver: "convoy"

  postgres:
    image: erwinnttdata/postgresql:latest
    restart: "always"
    depends_on:
      - postgres_data
    volumes_from:
      - postgres_data

volumes:
    vol1:
        driver: "convoy"
arevolumes kinenhancement

Most helpful comment

Just to be clear, this is a request to support the following syntax:

volumes:
  volume_name:
    name: docker_volume_name

Where the name property of a volumes entry would be to volumes what the container_name property of a services entry is to containers.

All 7 comments

No, it's not possible. If you want control over the name, create the volume yourself first and refer to it in the Compose file as external:

volumes:
  vol1:
    external:
      name: my-volume-name

Can we handle this as a change request?
It would be rellay nice if I can set the volume name for volumes I create with docker-compose.
For now, there will be a prefix added at the volume name, but it would be nice if we can avoid this.

Just to be clear, this is a request to support the following syntax:

volumes:
  volume_name:
    name: docker_volume_name

Where the name property of a volumes entry would be to volumes what the container_name property of a services entry is to containers.

Some storage providers, like when using Digital Ocean Block Storage with RexRay, do not support underscores (_) and I'd need therefore to provide a custom name :(

I've created a PR at https://github.com/docker/compose/pull/4573 to have an additional actual_name property, which can be used as the "real name" when creating the volume.

I would suggest the onus is on those drivers to support the same range of names that the native Docker experience does. Is there any reason not to support underscores in volume names?

I've already opened a support ticket at Digital Ocean.

On 7 Mar 2017 01:31, "Joffrey F" notifications@github.com wrote:

I would suggest the onus is on those drivers to support the same range of
names that the native Docker experience does. Is there any reason not to
support underscores in volume names?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/docker/compose/issues/3731#issuecomment-284581192,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABJqtOlWoD-opExq9ZqiPzrAjcORhBKRks5rjKVegaJpZM4JMms8
.

Was this page helpful?
0 / 5 - 0 ratings