Docker Community Forums

Share and learn in the Docker community.

Docker containers volumes do not shared to host


(Alarmikus) #1

Hello,

If mounting volumes via docker-compose, it is just copy the source folder to destination. I can’t write from containers to host :frowning:

   services:
      test:
        build: .
        image: test 
          volumes:
            - /host/tmp:/workdir/tmp

But If mounting volumes in starting image - it works, and possible to share files from container to host:
docker run -v /host/tmp:/workdir/tmp bc140663d937

Why is different and how to correct mounting volumes in docker-compose?