I'm using docker-compose for defining my service. In docker, there are two concepts for docker volume. Firstly is about bind mount
: mount on host storage.
docker run -d --name web-app -v $HOST/location:/container/location -p 80:80 httpd:latest
Secondly is about managed mount
: abstract storage, not depend on host.
docker run -d --name web-app -v /container/location -p 80:80 httpd:latest
I want to map those concepts to docker-compose. It means how can I define bind mount
and managed mount
when using docker-compose.
You can find these Docker concepts in the
volumes
section of Docker Compose: https://docs.docker.com/compose/compose-file/#/volumes-volumedriverExamples: