【发布时间】:2021-06-12 11:18:16
【问题描述】:
我尝试使用 docker 设置 run rails 项目,所以我构建了一个 dockerfile,如下所示
FROM ruby:2.6.6
RUN apt-get update -qq && apt-get install -y build-essential
# for mysql
RUN apt-get install -y default-libmysqlclient-dev
RUN apt-get install -y git-core zlib1g-dev libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev nodejs yarn
RUN gem install bundler
ENV APP_HOME /myapp
RUN mkdir $APP_HOME
WORKDIR $APP_HOME
ADD Gemfile* $APP_HOME/
RUN bundle install
ADD . $APP_HOME
当我运行docker build . 时,它总是出现如下错误:
=> ERROR [10/11] RUN bundle install 1.0s
------
> [10/11] RUN bundle install:
#14 0.850 Resolving dependencies...
#14 0.909 Unable to find a spec satisfying nokogiri (~> 1.8) in the set. Perhaps the
#14 0.909 lockfile is corrupted? Found nokogiri (1.11.2-x86_64-darwin) that did not match
#14 0.909 the current platform.
------
executor failed running [/bin/sh -c bundle install]: exit code: 7
所以请帮帮我。
【问题讨论】:
-
您的主机不是
x86,这与您的 CPU 架构不匹配。我假设你在Apple M1上构建它 -
不,我不使用 Apple M1,我看到的问题是我为 nokogiri gem 安装了
libxslt-dev liblzma-dev patch
标签: ruby-on-rails ruby docker nokogiri