在Windows 7上的Docker撰写:找不到Gemfile或.bundle /目录

当我运行docker-compose up命令时出现以下错误

找不到Gemfile或.bundle /目录
退出代码10

以下是代码。

注意:我已经使用Oracle VM虚拟框pipe理器将我的代码的父目录作为永久共享文件夹添加到VM。

任何想法来解决这个问题。

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撰写

 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 

您正在容器中创build.bundle目录,然后使用主目录对其进行掩码,因为您正在使用卷:

 volumes: - .:/student-api 

您需要在主机上运行bundle install ,或者从Compose文件中删除卷。

你是否在你的HOMEpath中挂载HOST目录(例如c:/ Users / john / *)。

请注意,在HOMEpath外面执行此操作无法正常工作。