前提・実現したいこと
docekrを使いrailsアプリを作成したい。
docker-compose run web rails new . --force --database=mysql
を実行したいが、エラーになる。
発生している問題・エラーメッセージ
docker-compose run web rails new . --force --database=mysql Building web Traceback (most recent call last): File "compose/cli/main.py", line 81, in main File "compose/cli/main.py", line 203, in perform_command File "compose/metrics/decorator.py", line 18, in wrapper File "compose/cli/main.py", line 970, in run File "compose/cli/main.py", line 1434, in run_one_off_container File "compose/project.py", line 664, in up File "compose/service.py", line 364, in ensure_image_exists File "compose/service.py", line 1133, in build File "compose/service.py", line 1841, in build compose.service.BuildError: (<Service: web>, {'message': 'dockerfile parse error line 3: unknown instruction: |'}) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "docker-compose", line 3, in <module> File "compose/cli/main.py", line 92, in main TypeError: can only concatenate str (not "dict") to str [18950] Failed to execute script docker-compose
該当のソースコード
docker-file
FROM ruby:2.7 RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update -qq \ && apt-get install -y nodejs yarn WORKDIR /app COPY ./src /app RUN bundle config --local set path 'vendor/bundle' \ && bundle install
docker-compose
version: '3' services: db: image: mysql:8.0 command: --default-authentication-plugin=mysql_native_password volumes: - ./src/db/mysql_data:/var/lib/mysql environment: MYSQL_ROOT_PASSWORD: password web: build: . command: bundle exec rails s -p 3000 -b '0.0.0.0' volumes: - ./src:/app ports: - "3000:3000" depends_on: - db
Gemfile
1source 'https://rubygems.org' 2 3gem 'rails', '~> 6.1.0'
試したこと
・エンコーディングがUFT8になっていると確認
・スペルミス、バックスラッシュ抜けのチェック
補足情報(FW/ツールのバージョンなど)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/08/27 08:07
2021/08/27 09:22