docker ruby​​ bundle 无效的 utf

docker ruby​​ bundle 无效的 utf

我正在为我的 rails 项目设置 docker。我收到错误:

/usr/local/bundle/gems/bundler-1.12.5/lib/bundler/ui/shell.rb:99:in `[]': invalid byte sequence in US-ASCII (ArgumentError)
    from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/ui/shell.rb:99:in `strip_leading_spaces'
    from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/ui/shell.rb:104:in `word_wrap'
    from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/ui/shell.rb:90:in `tell_me'
    from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/ui/shell.rb:35:in `error'
    from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:21:in `log_error'
    from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:100:in `rescue in with_friendly_errors'
    from /usr/local/bundle/gems/bundler-1.12.5/lib/bundler/friendly_errors.rb:98:in `with_friendly_errors'
    from /usr/local/bundle/gems/bundler-1.12.5/exe/bundle:19:in `<top (required)>'
    from /usr/local/bundle/bin/bundle:22:in `load'
    from /usr/local/bundle/bin/bundle:22:in `<main>'

我尝试运行 locale-gen 并为我的 docker 环境设置语言环境,但是失败了。这是我的 Dockerfile:

FROM ruby:2.2.4
CMD ["/bin/bash", "locale-gen", "en_US.UTF-8"]
RUN ruby --version
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs
RUN mkdir /keypoints
WORKDIR /keypoints
ADD Gemfile /keypoints/Gemfile
ADD Gemfile.lock /keypoints/Gemfile.lock

RUN gem install bundler
RUN gem update bundler
RUN gem install puma
ADD . /keypoints
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN bundle install

有人成功部署过 ruby​​ on rails docker 吗?好像失败了

RUN bundle install

谢谢

答案1

我能够解决容器内这些东西的编码问题:

export LANG="C.UTF-8"
export LC_ALL="C.UTF-8"

相关内容