Docker container volume doesn't write to host

Hi i try to generate some assets within a docker container and put it to a host. All that is running within a docker-machine environment initialised with virtualbox driver.

for example i run:

  • i/o timeout error using progrium/docker-consul
  • `const_get': uninitialized constant [class] (NameError)` after file save in Docker with Spring
  • Jenkins: pass (environment) variable to Docker while building the image
  • Vagrant + Docker + Postgresql - Cannot connect from host
  • Confusing status on virtualbox+fabric8/kubernetes+docker
  • Heroku Permission denied: AH00072: make_sock: could not bind to address [::]:80
  • docker run -it -v $PWD/testfolder:/var/www:rw ubuntu /bin/bash
    

    and then

    root@b9e73827bc3c:/var/www touch dummy.txt
    

    from that point i actually have to see dummy.txt in my host’s $PWD/testfolder folder, but there is neither a folder testfolder nor dummy.txt in it(logicly).

    The weired thing, the same setup works correct on MacOSX and creates files on a host end, but when i tried it Ubuntu:14.04 it stopped working.
    here are both container inspect on

    • MacOSX host: https://gist.github.com/zavalit/65e8a260866f834223616c1b59e4ce7d
    • Ubuntu:14.04 host:
      https://gist.github.com/zavalit/40bd3ce8629ad81fcd6793ca63f99491

    as far as i can see, they are both quite identical.

    it tried it with both docker-machine version 0.7.0-rc2 and 0.6.0, docker version is 1.10.3

    did anyone experienced, stuff like that? i’m pretty much appreciate any possible tipps. thx.

  • unable to install pg-native (libpq-dev) on ubuntu 14.04
  • Docker container can't resolve DNS to reach another AWS Ec2 Machine
  • What's the mechanism of Inner Load Balancing along with docker swarm v1.12
  • Attach terminal and launch docker compose?
  • How to change docker0 setting in CoreOS?
  • How to get /etc/profile to run automatically in Alpine / Docker
  • 3 Solutions collect form web for “Docker container volume doesn't write to host”

    you will need to manually setuo your VM to bind folders with your local machine.
    You can follow these instructions :
    Docker + Ubuntu + Virtualbox: "volumes" directive in dockerfile not working

    But, why are you using a VM under ubuntu?
    You can use docker without any VM under Linux systems.

    You must not run docker inside docker machine if you are on linux. You can install it using apt https://docs.docker.com/engine/installation/linux/ubuntulinux/.

    It does not required docker-machine and it is not a good idea to use it.

    What you want to do works fine using docker on linux (without docker machine).

    Probably you are running the docker run after you issue a docker-machine ssh

    In that case your files are inside the VM.

    If running docker run in your host gives you error or doesn’t run the engine in your VM, you must issue first:

    . docker-machine env
    

    Regards

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