Mounting local volumes to docker container

Edited for clarity

I run the following run command

  • Nodejs child process-spawn in a container-docker
  • Docker not response after long not using on windows 10 host
  • Docker Jenkins Integration
  • What does |1 mean in Docker history
  • how to reach docker containers with network host from w10 pc?
  • Docker overlay networking centos7
  • docker run -d -P -v /users/username/app:/app contname
    

    This resulsts in the following when i inspect the container

    "HostConfig": {
            "Binds": [
                "/users/username/app:/app"
            ],
    
    "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?

  • Securing services within Docker container Using Identity Providers hosted within a container
  • How to build docker images for windows using VS2017 and Docker integration?
  • Docker launch 2 processes in the conatiner
  • Docker proxy windows daemon named pipe to Ubuntu Container
  • Cannot remove all containers in a row
  • Docker container connection to gateway refused
  • 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.