Docker Compose on Windows 7: Could not locate Gemf

2019-07-15 04:45发布

I get the following error when I run the command docker-compose up

Could not locate Gemfile or .bundle/ directory
exited with code 10

Following is the code.

Note : I have added the parent directory of my code as a permanent shared folder to the VM using Oracle VM virtual box manager.

Any thoughts to resolve the issue.?

Dockerfile

FROM ruby:2.3.0
ENV HTTP_PROXY http://proxy.com:8080
ENV HTTPS_PROXY http://proxy.com:8080
RUN mkdir /student-api
WORKDIR /student-api
ADD Gemfile /student-api/Gemfile
ADD Gemfile.lock /student-api/Gemfile.lock
RUN bundle install
ADD . /student-api

Docker Compose

db:
  image: postgres
  ports:
    - "5432:5432"
web:
  build: .
  command: bundle exec rails s -p 3000 -b '0.0.0.0'
  volumes:
    - .:/student-api
  ports:
    - "3000:3000"
  links:
    - db

2条回答
爷的心禁止访问
2楼-- · 2019-07-15 04:58

Are you mounting HOST directory within your HOME path (e.g. c:/Users/john/*).

Be advised that doing this outside HOME path does not work correctly.

查看更多
唯我独甜
3楼-- · 2019-07-15 05:01

You are creating the .bundle directory in the container, then masking it with the host directory , because you're using a volume:

volumes:
    - .:/student-api

You need to either run the bundle install on the host, or remove the volume from the Compose file.

查看更多
登录 后发表回答