I'm currently working on setting up a Rails boilerplate via docker. When I try to run `docker build .` I get the following error:

```
Step 5/8 : COPY Gemfile /app/
COPY failed: stat /var/lib/docker/tmp/docker-builder090950451/Gemfile: no such file or directory

```

I'm following the directions in the [documentation](https://docs.docker.com/compose/rails/) but I still have not been able to build the image.

Here is my Dockerfile

```
FROM ruby:2.5
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs

WORKDIR /app

# Copy the existing Gemfile
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock

# Install Gems
RUN bundle install
COPY . /app

```

I also have the following `docker-compose.yml` file:

```
version: '3'
services:
  db:
    image: postgres # To Edit - Default is postgresql.
  web:
    build: .
    command: bundle exec rails s -p 3000 -b '0.0.0.0'
    volumes:
      - .:/app
    ports:
      - "3000:3000"
    depends_on:
      - db

```

I generated the Rails application by running `docker-compose run web rails new app --force --database=postgresql` which does generates the rails application with its Gemfile as shown in the image below.[![enter image description here](https://i.stack.imgur.com/FQZdA.png)](https://i.stack.imgur.com/FQZdA.png)

However after generating the rails application and running `docker-compose build` I get the following error:

```
db uses an image, skipping
Building web
Step 1/7 : FROM ruby:2.5
 ---> 55fb4a37704e
Step 2/7 : RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
 ---> Using cache
 ---> afb6f347904c
Step 3/7 : WORKDIR /app
 ---> Using cache
 ---> 1fdbd260685d
Step 4/7 : COPY Gemfile /app/Gemfile
ERROR: Service 'web' failed to build: COPY failed: stat /var/lib/docker/tmp/docker-builder885442968/Gemfile: no such file or directory

```