docker's VOLUME isn't mounting host files

I have this docker file:

FROM node:0.10.38
VOLUME /opt/build
WORKDIR /opt/build
EXPOSE 8080
CMD node app.js

However, when I got to run the container, I get the error that app.js does not exist, specifically /opt/build/app.js does not exist. I’ve also tried ADD and COPY to do this, both say it can’t find anything, and I’d like to use VOLUME so it writes to the host’s log that is also in /opt/build. All desired files are in fact on the host as well. By the way, I’m using coreos as the host OS.

  • 100 docker containers vs 100 small machines
  • How to tag a docker container?
  • Tensorflow Object Detection Killed before starting
  • How to port data-only volumes from one host to another?
  • Boot2Docker mannaging ports and openning webapplications
  • Why does pushing a Docker image fail with “dial tcp: lookup cdn-registry-1.docker.io on 192.168.1.1:53: read udp 192.168.1.1:53: i/o timeout”?
  • fail to upgrade docker on redhat7
  • How to email from Wordpress in Docker container?
  • Graylog 2.2.0-beta.1 in Docker with UDP input: Unable to load default stream
  • Is Volume in Docker a security hole?
  • Docker run command on Bluemix does not allow to set environment variable correctly
  • How to programmatically specify the IP and port of a dependent docker container created by Marathon?
  • One Solution collect form web for “docker's VOLUME isn't mounting host files”

    As documented in http://docs.docker.com/userguide/dockervolumes/#volume

    The VOLUME Dockerfile command is equivalent to -v /opt/build (“Adding a data volume”), not equivalent to -v /opt/build:/opt/build (“Mount a Host Directory as a Data Volume”); the latter is what you want here.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.