Ruby on rails 您的“bin/bundle”不是由Bundler生成的,因此此binstub无法运行
我正在尝试创建一个Rails容器。在我的Dockerfile中,我有以下内容Ruby on rails 您的“bin/bundle”不是由Bundler生成的,因此此binstub无法运行,ruby-on-rails,docker,bundler,Ruby On Rails,Docker,Bundler,我正在尝试创建一个Rails容器。在我的Dockerfile中,我有以下内容 # Use the barebones version of Ruby 2.3. FROM ruby:2.3-slim # Install dependencies: # - build-essential: To ensure certain gems can be compiled # - nodejs: Compile assets # - libpq-dev: Communicate with postgr
# Use the barebones version of Ruby 2.3.
FROM ruby:2.3-slim
# Install dependencies:
# - build-essential: To ensure certain gems can be compiled
# - nodejs: Compile assets
# - libpq-dev: Communicate with postgres through the postgres gem
RUN apt-get update && apt-get install -qq -y --no-install-recommends \
build-essential nodejs libpq-dev
# Set an environment variable to store where the app is installed to inside
# of the Docker image. The name matches the project name out of convention only.
ENV INSTALL_PATH /dockerzon
RUN mkdir -p $INSTALL_PATH
# This sets the context of where commands will be ran in and is documented
# on Docker's website extensively.
WORKDIR $INSTALL_PATH
# Ensure gems are cached and only get updated when they change. This will
# drastically increase build times when your gems do not change.
COPY Gemfile Gemfile
# We want binstubs to be available so we can directly call sidekiq and
# potentially other binaries as command overrides without depending on
# bundle exec.
RUN bundle binstubs bundler --force
RUN bundle install --binstubs
# Copy in the application code from your work station at the current directory
# over to the working directory.
COPY . .
.
.
.
REMAINING FILE TRUNCATED
在容器定义中,我有以下内容
“命令”:[“/bin/sidekiq”]
当容器运行时,我收到以下错误:
您的bin/bundle
不是由Bundler生成的,因此此binstub无法运行。
通过运行bundle-binstubs-bundler--force替换bin/bundle
,然后再次运行此命令
现在,如果我跑
RUN bundle binstubs bundler --force
以前
RUN bundle install --binstubs
我得到这个错误
Step 8/13 : RUN bundle binstubs bundler --force
---> Running in 6ed1f7228694
Could not find gem 'rails (= 4.2.6)' in any of the gem sources listed in your
Gemfile.
ERROR: Service 'dockerzon' failed to build: The command '/bin/sh -c bundle binstubs bundler --force' returned a non-zero code: 7
添加运行bundle binstubs bundler——在安装bundle之前强制执行。
这个问题是bundler知道的。请参阅:
步骤8/13:运行bundle binstubs bundler--force-->6ed1f7228694中运行的程序在gem文件中列出的任何gem源中都找不到gem“rails(=4.2.6)”。错误:服务“dockerzon”无法生成:命令“/bin/sh-c bundle binstubs bundler--force”返回一个非零代码:7首先,他在bundle安装之前运行了它,我们得到了他按正确顺序列出的错误消息。所以,这不是一个真正的解决方案。