0

I have a docker compose similar to this one

services:

  service-a:
    image: "service-a"
    volumes:
      - /home/user/data:/data

  service-b:
    image: "service-b"
    volumes:
      - /home/user/data:/data

  service-c:
    image: "service-c"
    volumes:
      - /home/user/data:/data

I'd like to use a named volume for all 3 to simplify it and make it more manageable, like this

services:

  service-a:
    image: "service-a"
    volumes:
      - namedvolume:/data

  service-b:
    image: "service-b"
    volumes:
      - namedvolume:/data

  service-c:
    image: "service-c"
    volumes:
      - namedvolume:/data

volumes:
  - namedvolume

The thing is that i need to insert some files into namedvolume, so I'd like to have it binded to a local directoy like it was before. How can I achieve this?

RabidTunes
  • 775
  • 1
  • 8
  • 21
  • [Docker: change folder where to store docker volumes](https://stackoverflow.com/questions/38396139/docker-change-folder-where-to-store-docker-volumes) lists out a couple of options, and in particular details how to create a named volume that's actually a bind mount; does one of those approaches work for you? – David Maze Feb 08 '23 at 11:30
  • @DavidMaze I think one of them might suit me, Im going to check and I'll update – RabidTunes Feb 08 '23 at 22:32

0 Answers0