Docker Compose on Windows 7: Could not locate Gemfile or .bundle/ directory

放肆的年华 提交于 2019-12-12 18:37:49

问题


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

回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/39018676/docker-compose-on-windows-7-could-not-locate-gemfile-or-bundle-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!