无法在dockerized rails应用程序中从git安装gem
请帮助我build立我的第一个docker形象。 我的Gemfile
包含:
gem 'webpacker', github: 'rails/webpacker'
这里是Dockerfile
:
FROM ruby:2.4-alpine ... ADD Gemfile $INSTALL_PATH/Gemfile ADD Gemfile.lock $INSTALL_PATH/Gemfile.lock RUN bundle install ADD . $INSTALL_PATH ...
docker工人和docker工人:
Docker version 17.03.1-ce, build c6d412e docker-compose version 1.13.0, build 1719ceb
当我跑步
docker build .
我收到错误:
Fetching https://github.com/rails/webpacker.git sh: git: not found Git error: command `git clone 'https://github.com/rails/webpacker.git' "/usr/local/bundle/cache/bundler/git/webpacker- 61415c05b31197242a5fde705ba334f36321be12" --bare --no-hardlinks --quiet` in directory /test_task has failed.
我想,原因是与github源相关,因为如果我从gemfile中删除所有的Github源的gem,那么gem将被正确地从rubygems存储库
更新 :当我使用ruby:2.4-slim
而不是alpine
linux作为基础的形象,然后构build完成没有错误
看来你没有在容器内的git。 要将其安装在Alpine图片上,您应该添加到您的Dockerfile中:
FROM ruby:2.4-alpine RUN apk update && apk add git ... the rest of your Dockerfile ...
希望能帮助到你。
- Dockerrun.aws.json结构ECR回购
- Docker与Nginx的Ubuntu,PHP的FPM和S3FS,但s3fs不起作用
- 我可以将在Docker容器中运行的脚本的输出作为本地文件夹吗?
- build立一个Docker镜像(.NET Core)并将其上传到Google Container Engine?
- 为什么在本地工作的服务会在docker中频繁地获取kill信号?
- 如何通过Dockerfile设置mysql系统variables,如max_allowed_packet max_allowed_packet,character_set_server和collation-server?
- 我怎样才能提高我的Boot2Docker虚拟机的性能
- Docker在自动化testing中
- prometheus notis“样本时间戳无序”