0

I have a bash script recipe that creates large assets. I'd like to create them once and use them in different docker containers. I'm assuming the best way to handle this is to create a docker volume containing these assets but how do I do that? I prefer not copy files into the volume directly from the host as that's not really version controlled. Can this be achieved using dockerfiles?

Milad
  • 4,901
  • 5
  • 32
  • 43

2 Answers2

1

You can use docker-compose.yml to set up a volume sharing between containers. And you can declare mount points in respective Dockerfiles using VOLUME instruction. More in detail explanation is in Volumes Documentation

lonelyelk
  • 598
  • 9
  • 25
0

I think this answers my question. In summary:

  1. Create a Dockerfile that's along these lines:
FROM ubuntu
RUN mkdir /dataset
RUN ***populate /dataset***
VOLUME /dataset
  1. Build the docker image
  2. Build a container from that image
  3. Mount /dataset in any container you need using --volumes-from option
Milad
  • 4,901
  • 5
  • 32
  • 43