ruby-on-rails – 在docker中没有安装私有宝石
发布时间:2020-12-17 01:56:29 所属栏目:百科 来源:网络整理
导读:我正在尝试使用docker运行rails应用程序.很少有宝石由 github的ssh url安装,如下所示: Gemfile gem 'swagger-docs',:git = 'git@github.com:xyz/swagger-docs.git',:branch = 'my_branch' 我在docker中添加了键,它能够克隆所需的repo并从git安装gem. Docker
我正在尝试使用docker运行rails应用程序.很少有宝石由
github的ssh url安装,如下所示:
gem 'swagger-docs',:git => 'git@github.com:xyz/swagger-docs.git',:branch => 'my_branch' 我在docker中添加了键,它能够克隆所需的repo并从git安装gem.
RUN mkdir -p /root/.ssh COPY ./id_rsa /root/.ssh/id_rsa RUN chmod 700 /root/.ssh/id_rsa RUN ssh-keygen -f /root/.ssh/id_rsa -y > /root/.ssh/id_rsa.pub RUN ssh-keyscan github.com >> /root/.ssh/known_hosts 当我构建它(包括捆绑安装)时,一切顺利,图像成功构建.但是当我运行docker-compose时,会出现以下错误 /usr/local/bundle/gems/bundler-1.9.2/lib/bundler/source/git/git_proxy.rb:155:in `allowed_in_path': The git source git@github.com:xyz/swagger-docs.git is not yet checked out. Please run `bundle install` before trying to start your application (Bundler::GitError) 解决方法
尝试在Gemfile中用https替换git,即
gem 'swagger-docs',git: 'https://github.com:xyz/swagger-docs.git',branch: 'my_branch' …或者在运行bundle install之前将其添加到Dockerfile中: RUN git config --global url."https://".insteadOf git:// 如果没有任何作用,那么只需运行两次捆绑安装,即 ... RUN gem install bundler && bundle install CMD bundle install && rails s -p 3000 -b 0.0.0.0 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容