Mounting local volumes to docker container

Edited for clarity

I run the following run command

  • What's eth0 used for in docker host machine
  • Failing to debug Nginx load-balancer
  • A completely closed source docker container
  • Why are there so many docker images with vulnerabilities? [closed]
  • What do the curly braces mean in docker inspect --format “{{.State.Pid}}”?
  • Apache2 Container on BlueMix won't stay up
  • docker run -d -P -v /users/username/app:/app contname

    This resulsts in the following when i inspect the container

    "HostConfig": {
            "Binds": [
    "Volumes": {
            "/app": "/users/username/app",
            "/app": "/mnt/sda1/var/lib/docker/vfs/dir/214a16c3678f93cbadb7e7b7d56b5f26b66a34c6d9bb89ade23b16e386a12212"

    But when i ssh into the container, i can see that app is empty.

    Is my assumption that there should be the files from my host machine correct?

  • Update the limitation of memory/CPU for existing container in docker
  • Using Docker in development for Java EE applications
  • `npm start` in docker ends with: Please install a supported C++11 compiler and reinstall the module
  • docker-compose error - unable to read file
  • Redirecting command output in docker
  • docker-compose Rails spring doesn't work
  • One Solution collect form web for “Mounting local volumes to docker container”

    Boot2docker automatically mounts your home directory into the virtualbox boot2docker VM not the container. You still need to add -v /users/username/app:/app to your docker run command.

    When you add the Volume command to your docker file you are declaring a volume to be created by the container. This volume is mounted at /var/lib/docker/volumes on the host VM. These volumes can only be shared by passing –volumes-from to the docker run command. When you pass the -v switch you creating a volume using a specified location on the host file system.

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