Winodows 1p Pro (64bit)
Vagrant 2.2.14
Ubuntu 16.04.6 LTS
Docker 18.09.7
ruby:ruby 2.7.2p137
DockerのRailsの開発環境を構築を勉強しています。
sudo docker-compose run web rails new . --force --database=mysql
を実行したところ、以下のエラーが表示されました。
Building web ERROR: Error processing tar file(signal: killed):
Quiitaを参照して調べましたがまったく分かりません。
rails_dockerの配下にDockerfileとocker-compose-ymlファイルを配置し、その下にsrcディレクトリを作成し
Gemfileを置いています。
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
Gemfile
source 'https://rubygems.org' gem 'rails', '~> 6.1.0'
docker-compose-yml
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" environment: RAILS_ENV: development depends_on: - db
しばらくして、再度実行したら以下のエラーが表示されました。
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /usr/local/bundle/gems/racc-1.5.2/ext/racc/cparse /usr/local/bin/ruby -I /usr/local/lib/ruby/2.7.0 -r ./siteconf20210122-7-k0z1kz.rb extconf.rb extconf failedCannot allocate memory - /usr/local/bin/ruby Gem files will remain installed in /usr/local/bundle/gems/racc-1.5.2 for inspection. Results logged to /usr/local/bundle/extensions/x86_64-linux/2.7.0/racc-1.5.2/gem_make.out An error occurred while installing racc (1.5.2), and Bundler cannot continue. Make sure that `gem install racc -v '1.5.2' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 6.1.1, which depends on actioncable was resolved to 6.1.1, which depends on actionpack was resolved to 6.1.1, which depends on actionview was resolved to 6.1.1, which depends on rails-dom-testing was resolved to 2.0.3, which depends on nokogiri was resolved to 1.11.1, which depends on racc ERROR: Service 'web' failed to build: The command '/bin/sh -c bundle config --local set path 'vendor/bundle' && bundle install' returned a non-zero code: 5
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/01/24 09:02 編集