Bundler fails inside Docker Container

November 4, 2014 4k views

Hi we created a droplet on DigitalOcean with Docker installed.

We added a new user and logged in as the user and we tried building a Docker image with a Ruby on Rails app in it.

But when it comes to the bundle install part it fails with the message:

"bundler http error: bundler could not fetch specs from ''".

Changing source of Gemfile to also gives same result.

I am able to do this successfully from outside the container.

Here is my Dockerfile:

FROM phusion/passenger-ruby21
MAINTAINER Steve Robinson ""

ENV HOME /root

CMD ["/sbin/my_init"]

RUN rm -f /etc/service/nginx/down

RUN rm /etc/nginx/sites-enabled/default

ADD ./config/nginx-docker-test.conf /etc/nginx/sites-enabled/docker-test.conf

RUN mkdir /home/app/docker-test

ADD Gemfile /tmp/
ADD Gemfile.lock /tmp/
RUN bundle install

ADD . /home/app/docker-test

RUN chown -R app:app /home/app/docker-test

WORKDIR /home/app/docker-test
RUN rake assets:precompile RAILS_ENV=production

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

Btw this is the blog that I have been following :)


  • Have you set up any firewalling? I was just able to successfully run a build of this Dockerfile using a skeleton rails project. Running bundle install with the --verbose flag might provide some more info.

    On another point, you should probably be running bundle install and rake as the app user if you are giving it ownership of the files.

  • I dont think I have any Firewall setup in the container. If I try with the --verbose this is what I get:

    And btw you are right about running bundle install as root. But I really need to get this running though :(

  • same issue for me with the passenger docker image.. any resolution @steverob ?

Be the first one to answer this question.