Bundler无法看到在dockerized环境中安装的gem
我有一个非常基本的“应用程序”,我试图dockerize使用在互联网上find的一些例子,但由于某种原因,似乎bundler不能看到安装在我的环境中的gem。
的Gemfile
source 'https://rubygems.org' gem 'streamio-ffmpeg'
Dockerfile
FROM dpsxp/ffmpeg-with-ruby:2.2.1 MAINTAINER mike RUN apt-get update && apt-get install -y \ build-essential \ cmake ENV APP_HOME=/app RUN mkdir -p $APP_HOME WORKDIR $APP_HOME COPY Gemfile* ./ ENV BUNDLE_GEMFILE=$APP_HOME/Gemfile \ BUNDLE_PATH=/bundle RUN gem install bundler RUN bundle install --jobs 20 --retry 5 --path=/bundle COPY . ./ CMD ["rake"]
泊坞窗,compose.yml
version: '2' services: app: build: context: . volumes: - '.:/app' depends_on: - bundle bundle: image: busybox volumes: - /bundle
现在,当我运行$ docker-compose run app gem list
,由于某种原因, streamio-ffmpeg
gem不在列表中。 此外,当我试图要求它在我的ruby应用程序,我得到LoadError: cannot load such file
build立日志: https : //gist.github.com/mbajur/569b4f221cadb8a85ecc5dae8a595401
当你通过bundler处理gem时,所有相关的命令都应该使用bundle exec
运行,所以在你的情况下,它应该使用下面的命令:
docker-compose run app bundle exec gem list
Bundler通过跟踪和安装所需的精确gem和版本,为Ruby项目提供一致的环境。
你用gem list
直接运行的命令是列出系统的gem,当然它们不在列表中。