実行コマンド
docker-compose run web rails new . --force --database=mysql
↑の実行コマンドでrailsのひな形作成したいのですが「ERROR: Service 'web' failed to build」が起きてうまく実行することができず困っています。
↓がそれぞれのファイル内容になっております。
Gemfile
1source 'https://rubygems.org' 2 3gem 'rails', '~> 6.1.0' 4
Dockerfile
1FROM ruby:2.7 2RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ 3 && echo "deb https://dl.yarnpkg.com/debian/ stablemain" | tee /etc/apt/sources.list.d/yarn.list \ 4 && apt-get update -qq \ 5 && apt-get install -y nodejs yarn 6WORKDIR /app 7COPY ./src /app 8RUN bundle config --local set path 'vendor/bundle' \ 9 && bundle install
docker-compose.yml
version: '3' services: db: image: mysql:8.0 command: --defaulst-authentication-plugin=mysql_native_password volumes: - ./src/db/mysql_data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: mysql_nativ_password web: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' volumes: - ./src:/app ports: - "3000:3000" depends_on: - db
実行結果
Pulling db (mysql:8.0)... 8.0: Pulling from library/mysql 69692152171a: Pull complete 1651b0be3df3: Pull complete 951da7386bc8: Pull complete 0f86c95aa242: Pull complete 37ba2d8bd4fe: Pull complete 6d278bb05e94: Pull complete 497efbd93a3e: Pull complete f7fddf10c2c2: Pull complete 16415d159dfb: Pull complete 0e530ffc6b73: Pull complete b0a4a1a77178: Pull complete cd90f92aa9ef: Pull complete Digest: sha256:d50098d7fcb25b1fcb24e2d3247cae3fc55815d64fec640dc395840f8fa80969 Status: Downloaded newer image for mysql:8.0 Building web Step 1/5 : FROM ruby:2.7 2.7: Pulling from library/ruby d960726af2be: Already exists e8d62473a22d: Already exists 8962bc0fad55: Already exists 65d943ee54c1: Already exists 532f6f723709: Already exists c405d0102486: Already exists a5f7ffb4af49: Already exists 68295a09b686: Already exists Digest: sha256:81de3f2e72b4d9583dd0541a2cc5a8359743bbb1af9c630582ccc2aa5cf1dfae Status: Downloaded newer image for ruby:2.7 ---> f3c7921feb83 Step 2/5 : RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stablemain" | tee /etc/apt/sources.list.d/yarn.list && apt-get update -qq && apt-get install -y nodejs yarn ---> Running in 05f45af7696b Warning: apt-key output should not be parsed (stdout is not a terminal) OK deb https://dl.yarnpkg.com/debian/ stablemain E: Malformed entry 1 in list file /etc/apt/sources.list.d/yarn.list (Component) E: The list of sources could not be read. ERROR: Service 'web' failed to build : The command '/bin/sh -c curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && echo "deb https://dl.yarnpkg.com/debian/ stablemain" | tee /etc/apt/sources.list.d/yarn.list && apt-get update -qq && apt-get install -y nodejs yarn' returned a non-zero code: 100
Docker,Ruby初心者で文章に不明点等あるかもしれませんがご教授いただけると幸いです。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/05/24 08:48