【发布时间】:2020-04-18 18:38:20
【问题描述】:
我在 Docker 容器中安装了 ruby 2.7,使用 Faraday 运行一个相当简单的 HTTP 客户端:
conn = Faraday.new("https://jinio.com.ph")
conn.post("/tracker", {p: @code}.to_json, {"Content-Type" => "application/json"})
此代码在容器内返回 SSL 错误“错误的签名类型”。
Faraday::SSLError (SSL_connect returned=1 errno=0 state=error: wrong signature type)
关于如何解决这个问题的任何想法?仅供参考,如果我在 Mac OS 上运行它,代码运行不会出错
如果有帮助,我的 Dockerfile:
FROM ruby:2.7
RUN apt-get update -qq && apt-get install -y nodejs postgresql-client nano
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install
COPY . /app
# Script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Start server
CMD ["rails", "server", "-b", "0.0.0.0"]
【问题讨论】:
-
当您使用容器运行 bash 时,使用
curl或wget的相同请求是否有效? -
在容器内运行 curl 也失败了:
curl: (35) error:1414D172:SSL routines:tls12_check_peer_sigalg:wrong signature type -
想知道更多关于为什么你的容器在你的域上出现 ssl 错误的信息。也许您的证书提供者根证书没有随您的容器一起提供?
-
或者,即使不推荐,您也可以跳过 SSL 检查:gist.github.com/doubleotoo/3942158
-
在将 Ruby 容器从 2.5 升级到 2.6 后,我遇到了同样的问题。我发现这篇文章描述了我认为的问题:medium.com/@andrewhowdencom/…
标签: ruby docker httparty faraday