Skip to content

"Quickstart: Compose and Rails" docker-compose run fails with Gemfile not found on some Windows systems #3842

@MartinSGill

Description

@MartinSGill

File: compose/rails.md, CC @londoncalling

I followed the guide on the docker website: https://docs.docker.com/compose/rails/ to the letter and it simply doesn't work.

When I get to the instruction to:

docker-compose run web rails new . --force --database=postgresql

It fails with:

Creating network "myproject_default" with the default driver
Creating myproject_db_1 ...
Creating myproject_db_1 ... done
/myapp/Gemfile not found

My docker-compose, dockerfile et.al. are exactly as they are on that page. I copy & pasted to make sure, including for future reference:

FROM ruby:2.3.3
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /myapp
WORKDIR /myapp
ADD Gemfile /myapp/Gemfile
ADD Gemfile.lock /myapp/Gemfile.lock
RUN bundle install
ADD . /myapp
version: '3'
services:
  db:
    image: postgres
  web:
    build: .
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
    volumes:
      - .:/myapp
    ports:
      - "3000:3000"
    depends_on:
      - db

I'm running Win10 (1703, 15063)
Docker version 17.06.0-ce, build 02c1d87
docker-compose version 1.14.0, build c7bdf9e3

Using linux containers.

I tried moving to "Users" folder as suggested (in this issue), but that didn't work.

Here's the full output:

>  docker-compose run web rails new . --force --database=postgresql
Creating network "myproject_default" with the default driver
Creating myproject_db_1 ...
Creating myproject_db_1 ... done
Building web
Step 1/8 : FROM ruby:2.3.3
 ---> 0e1db669d557
Step 2/8 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
 ---> Using cache
 ---> 764e8166aefd
Step 3/8 : RUN mkdir /myapp
 ---> Using cache
 ---> 581643096b98
Step 4/8 : WORKDIR /myapp
 ---> Using cache
 ---> 04daa3abaed8
Step 5/8 : ADD Gemfile /myapp/Gemfile
 ---> Using cache
 ---> 8c7cdbacf3cf
Step 6/8 : ADD Gemfile.lock /myapp/Gemfile.lock
 ---> Using cache
 ---> 3f22baab56ca
Step 7/8 : RUN bundle install
 ---> Using cache
 ---> e81df956f9d6
Step 8/8 : ADD . /myapp
 ---> 4db50dddc2ec
Removing intermediate container a7a878cb6a49
Successfully built 4db50dddc2ec
Successfully tagged myproject_web:latest
WARNING: Image for service web was built because it did not already exist. To rebuild this image you must use `docker-composebuild` or `docker-compose up --build`.
/myapp/Gemfile not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/composeRelates to docker-compose.yml spec or docker-compose binarylifecycle/locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions