I want to create an app with Rails in a Docker container.docker-compose error

Asked 2 years ago, Updated 2 years ago, 91 views

I'm trying to create an app with Rails using WSL on Windows.

If you run the following command inside the container, you can use the

 rails new. --force --database=postgresql --skip-bundle

The Gemfile will be updated and you will need to install bundle.

Therefore, we executed the following command after exiting from the container:

 docker-compose up --build-d

The following error occurred:

[+]Building 0.9s (2/3)
[+] Building 1.0s (3/3) FINISHED
 =>[internal] load build definition from Dockerfile 0.1s
 =>=>transferring dockerfile:32B 0.1s
 =>[internal] load.dockerignore 0.1s
 =>=>transferring context—2B 0.0s
 =>ERROR [internal] load metadata for docker.io/library/ruby:2.5 0.8s
------
 >[internal] load metadata for docker.io/library/ruby:2.5:
------
failed to solve:rpc error:code=Unknown desc=failed to solve with frontend dockerfile.v0:failed to create LLB definition:rpc error:code=Unknown desc=error getting credentials-err:exit status1,out:

docker-compose.yml looks like this:

version: '3'

services:
  web:
    build:.
    ports:
      - '3000:3000'
    volumes:
      - '.:/product-register'
    tty —true
    stdin_open —true

The Dockerfile looks like this:

 FROM ruby: 2.5
RUN apt-get update & apt-get install-y\
    build-essential\
    libpq-dev\
    nodejs\
    postgresql-client\
    yarn

WORKDIR/product-register
COPY Gemfile Gemfile.lock/product-register/
RUN bundle install

Inside the container,

 rails new. --force --database=postgresql --skip-bundle

The following commands before running worked:

 docker-compose up-d

What is this error?

What should I do again?

Thank you for your cooperation.

ruby-on-rails docker wsl

2022-09-30 17:30

1 Answers

After a while,

 docker-compose up --build-d

It worked well for some reason.

Thank you.

If you know the cause, I would appreciate it if you could give me a comment.

Thank you for your cooperation.


2022-09-30 17:30

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.