Mount directories

How to mount host directories when building docker image(using Dockerfile)?

Do you need more than an explicit COPY or ADD step?

Yes , I used COPY and ADD but both are unable to mount required directory
present under /usr/local.

Add and Copy do not ‘mount’ the the directory to the container, it copies the data to the image. If you want to mount it, so that the container can access anything in that directory on the host, you have to do either:

  1. mount s a VOLUME when you RUN the image and make a container using the -v flag
  2. mount it in the volume section of a docker-compose file
    or
  3. use the VOLUME attribute in the docker file https://docs.docker.com/engine/reference/builder/#volume