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?
            Asked
            
        
        
            Active
            
        
            Viewed 75 times
        
    2 Answers
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:
- Create a Dockerfilethat's along these lines:
FROM ubuntu RUN mkdir /dataset RUN ***populate /dataset*** VOLUME /dataset
- Build the docker image
- Build a container from that image
- Mount /datasetin any container you need using--volumes-fromoption
 
    
    
        Milad
        
- 4,901
- 5
- 32
- 43