Search code examples
dockervolume

Multiple folders in one docker volume


I have two folders, let's say /etc/folder1 and /etc/folder2. I want to map them both in the same docker volume. So that I have these two folders in the root of my volume. Is that possible?

What I want is:

/etc/folder1 
/etc/folder2
and then /vol1/folder1 and /vol1/folder2

Solution

  • i think it is possible with:

    php:
        image: imagename
        volumes:
            -/etc/folder1:/folder1
            -/etc/folder2:/folder2
    

    you have to create folder1 & folder2 in your Dockerfile.

    ...
    RUN  mkdir folder1 folder2
    ...