Docker volume problem

  docker, question

I wanted to test maven in docker, so:


The cloud-user service is a maven project, and its dockerfile is as follows:


I want to mount /Users/wangbin/.m2/repository to /root/.m2/repository as soon as the container is opened.
However, the actual doc-composeup-d-build did not seem to mount successfully?
I use it manually.

docker run -it -v /Users/wangbin/.m2/repository:/root/.m2/repository maven:3.5.0-jdk-8 bash

This way into the container ls -a found that it can be mounted, but writing in dockerfile is not successful. Why?

Just write this line into docker-compose.yml