【发布时间】:2017-10-18 21:15:04
【问题描述】:
这里是 ruby 和 bundler 的新手。 我正在使用此 docker 文件将它们安装在 docker 映像中:
FROM alpine:3.5
# Install Ruby, Ruby Bundler and other ruby dependencies
RUN apk add --update \
ruby ruby-bigdecimal ruby-bundler \
ca-certificates libressl \
libressl-dev build-base ruby-dev \
ruby-rdoc ruby-io-console ruby-irb; \
\
&& bundle config build.nokogiri --use-system-libraries; \
&& bundle config git.allow_insecure true; \
\
&& gem install json foreman --no-rdoc --no-ri; \
&& gem cleanup; \
&& rm -rf /usr/lib/ruby/gems/*/cache/*; \
&& apk del libressl-dev build-base ruby-dev; \
&& rm -rf /var/cache/apk/* /tmp;
CMD ["bundle"]
当我运行 docker run 时,我得到:
Don't run Bundler as root. Bundler can ask for sudo if it is needed,
and installing your bundle as root will break this application for all
non-root users on this machine.
Could not locate Gemfile or .bundle/ directory
我该如何解决这个问题?我只想安装 ruby 和 ruby-bundle 并完成这个...
【问题讨论】:
-
机器有非root用户吗?
-
这是一个 docker 容器,所以我不这么认为。
-
我也没有。为什么不直接忽略警告?
-
来自该容器的完整日志是:不要以 root 身份运行 Bundler。如果需要,Bundler 可以请求 sudo,并且以 root 身份安装您的 bundle 将破坏此计算机上所有非 root 用户的应用程序。找不到 Gemfile。你知道这个“找不到 Gemfile”吗?
-
运行bundle需要目录中有gemfile,要么没有gemfile,要么你在错误的目录
标签: ruby docker bundler dockerfile root