Docker Community Forums

Share and learn in the Docker community.

Cant figure out if mounting volumes in docker compose is working


(Rkayg) #1

I am fairly new to docker and docker for mac beta but I am having an issue with mounting a volume using the docker-compose.yml

Expected behavior

Changes in the mounted volume in the host should be seen in the container.

Actual behavior

Doesn’t seem like anything is happening.

Information

OS X: version 10.10.3 (build: 14D136)
Docker.app: version v1.11.1-beta11
Running diagnostic tests:
[OK] docker-cli
[OK] Moby booted
[OK] driver.amd64-linux
[OK] vmnetd
[OK] osxfs
[OK] db
[OK] slirp
[OK] menubar
[OK] environment
[OK] Docker
[OK] VT-x
Docker logs are being collected into /tmp/20160519-223125.tar.gz
Most specific failure is: No error was detected
Your unique id is: 034538E4-B4B3-4C84-942C-C66119C3B92A

Dockerfile

FROM node:6-onbuild

RUN useradd --user-group --create-home --shell /bin/false app
RUN chown -R app:app /usr/src/*

USER app

docker-compose.yml

db:
  image: mongo
  ports:
    - "27017:27017"

app:
  build: .
  command: npm run develop:docker
  ports:
    - "8080:5465"
  volumes:
    - .:/user/src/app
  links:
    - db
  environment:
    MONGODB: mongodb://db:27017/brigadehub-docker
    GITHUB_ID: githubid
    GITHUB_SECRET: githubsecret

(David Maze) #2

Typo (in the container directory in the docker-compose.yml file)?

There have also been a couple of reports on the forum of people having pretty significant problems with this specific pattern: running something like npm install from inside Docker against a host directory tends to be slow and stresses out the VM-to-host filesystem interface. In my experience, it works fine to build a fixed container with your application

ADD . /usr/src/app
CMD npm run develop:docker

You will then need to docker-compose build if you change your application code.


(Rkayg) #3

Oh I knew I was doing something silly!
Thanks so much for your help.

  • Rahul