compose: Unable to find GemFile
Hey all,
I’m currently configuring docker-compose on my Linux Mint machine. The problem is, I’m able to build the web aspect of my project without errors. However, when it comes to running the rails server
, rails console
, or really anything that involves the rails
command, I’m getting the following errors:
web_1 | Could not locate Gemfile or .bundle/ directory
/myapp/Gemfile not found
Any idea what’s going on here. Posting my docker-compose.yml and related files below.
Docker Version: 1.8.2 Docker Machine Version: 0.4.0 Docker Compose Version: 1.4.2
docker-compose.yml
db:
image: postgres:9.4.1
ports:
- "5432:5432"
web:
extends:
file: common.yml
service: webapp
build: .
command: bundle exec thin -D start
ports:
- "3000:3000"
links:
- db
Common.yml
webapp:
environment:
RAIL_ENV: development
volumes:
- .:/myapp
Dockerfile
FROM ruby:2.2.2
ENV LANG C.UTF-8
RUN apt-get update -qy
RUN apt-get upgrade -y
RUN apt-get update -qy
RUN apt-get install -y build-essential
# for postgres
RUN apt-get install -y libpq-dev
# for nokogiri
RUN apt-get install -y libxml2-dev libxslt1-dev
# for capybara-webkit
#RUN apt-get install -y libqt4-webkit libqt4-dev xvfb
# for a JS runtime
RUN apt-get install -y nodejs
ENV APP_HOME /myapp
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ADD Gemfile* $APP_HOME/
RUN bundle install
ADD . $APP_HOME
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 19
The volume is masking the contents of the image. You need to either remove
volumes: - .:/srv/app
or make sure that you have the bundle contents on the host as well. The Compose guides do this by running something likedocker-compose run app bundler install ...
I’m leaving this comment as a signpost for others. The error message in the OP matched one I encountered while using a volume for bundled gems between containers ( api, resque, resque-scheduler etc).
I hit the same error using Fedora25 with SELinux and Win10 using docker-toolbox. For SELinux Permissive works, bundle completes in the build phase. For win10 it was due to the project being outside the Users folder. Moving it inside Users home allowed progress.
HTH
My docker-compose.yml
docker-compose goes OK
BUT
docker-compose up throws:
I had pretty much the same error, I also posted here. For
docker-machine
to work on Windows, we must place project files somewhere insideC:/Users/
otherwise volumes won’t mount, leaving an empty folder.I suppose one can add a shared folder on the
docker-machine
in virtualbox’s settings in case project is in a different drive, but I did not go this way. We simply moved the project to a valid place.(Almost) same her as Colindensem, but on Win7 instead of Win10. Whole project copied to Users folder, and starting from there: problem solved. This is not an option on the long term, but for the time being i at least can run my project. (Using this as a clue, we might find a solution that will keep the app’s on the development drive)
tried that…
Still the same
My docker file is like this:
I would recommend trying the following:
docker-compose rm
to clear out old volumes, then doup
again..:/myapp
should work as a volume path