Docker Community Forums

Share and learn in the Docker community.

Virtualbox docker host files updated by docker but not new ones created


(Bluejaydelta) #1

I’ve got what to me is a strange issue in a boot2docker vb vm.

I’m running a rails project inside docker on windows 8. If i exec a rails command, that changes files, to the container i can see in my windows hosted dir that the files get updated.

But if I run a command that generates a new file(s) (including touch test.txt) I don’t see anything.

Adocker-compose exec ....... ls ... shows that the files are created but I cant see them outside nor can i copy (cp <container>:src_dir host_dir) them to the linux vm folder, including the one mounted from windows.

I can touch a file into the folder shared with the linux vm from the docker machines cmd/bash and see it in the windows host dir.

After a Lot of googling and visiting many posts here I think i may need to create a “pipeline” to allow the new files to be copied over to the shared host folder in the linux vm? or change the propagation to rshared, but i’m still very much learning the ropes to docker so unsure if or how to.

I have pasted some info from the container etc below:

docker-machine start > env > eval(...etc)
then
docker-compose up

when the project is up, I ran:
docker exec <containerID> rails generate controller <ControllerName> new
(above taken from a guide, no errors shown when running)

Below are my compose file and sections of a docker inspect I felt would be relevant to this problem.

DOCKER-COMPOSE.yml

version: '2'
services:
  my-proj:
    command: ["/opt/docker/wait-for-it.sh", "db:5432", "--", "/opt/bin/setup"]
    image: rails:latest
    volumes:
      - ../:/opt
    expose:
      - 4000
    ports:
      - 4000:4000
    depends_on:
      - db
    stdin_open: true
    tty: true
  db:
    image: postgres:9.6.1
    expose:
      - 5432
    ports:
      - 5432:5432
    environment:
      - POSTGRES_PASSWORD=psswd
      - POSTGRES_USER=user
      - POSTGRES_DB=my_proj_dev

INSPECT

"HostConfig": {
            "Binds": [
                "/c/Users/ME/Docker/my-proj:/opt:rw"
            ],
...
"Mounts": [
            {
                "Type": "bind",
                "Source": "/c/Users/ME/Docker/my-proj",
                "Destination": "/opt",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],
...
"Config": {
            ...
            "Image": "rails:latest",
            "Volumes": {
                "/opt": {}
            },
            "WorkingDir": "/usr/src/app",

Can anyone help or point me in the right direction on how to solve this please. The project and docker-compose file came from another developer and worked fine on his non windows machine (although I cannot say if he ran the rails commands through docker or simply through ruby on the machine itself)