【问题标题】:Docker In Docker - SSL problemsDocker 中的 Docker - SSL 问题
【发布时间】:2016-08-10 19:37:44
【问题描述】:

我在我们的 CI 管道中使用 Docker In Docker for Jenkins Slaves。

我遇到了关于 SSL 的问题。问题是 maven 无法访问位于我们的 Nexus 存储库中的工件,它只是挂起。

我尝试使用 curl 进行调试。

在 DinD 容器内,一切正常:

$ curl -I https://www.google.com
HTTP/1.1 200 OK

如果我运行:

bash-4.3# curl -I --insecure  https://nexus.eng.myco.com/nexus
curl: (35) Unknown SSL protocol error in connection to nexus.eng.myco.com:443`

它挂了很长时间,然后我得到这个错误:

curl: (35) Unknown SSL protocol error in connection to nexus.eng.myco.com:443`

我可以运行有问题的curl 语句上一级(运行有问题的 docker 容器的 docker 容器),一切都很好。

我应该注意,如果我在笔记本电脑上运行有问题的 DinD 容器(虽然不是在 DinD 中),它没有问题。

使用调试信息更新:

bash-4.3#  curl -v -I https://nexus.eng.myco.com/nexus/content/groups/this>
*   Trying 54.164.137.27...
* Connected to nexus.eng.my.com (44.164.137.27) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
* TLSv1.2 (OUT), TLS handshake, Client hello (1):

有什么想法吗?

【问题讨论】:

    标签: docker ssl jenkins curl docker-in-docker


    【解决方案1】:

    可能现在回答为时已晚,但我会放在这里以防其他有类似问题的陌生人。
    我建议检查父容器和子容器中的 MTU。

    ip addr | grep mtu
    

    如果您看到 MTU 的差异
    例如

    3: eth0@if14: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1402 qdisc noqueue state UP group default
    4: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
    

    它需要更正为相同。
    例如

    ip link set dev eth0 mtu 1500
    

    【讨论】:

    • 其实不行,docker container mtu 不能让我的主机都更小,它们不应该完全相同。当您在 openstack 网络中使用 docker 时,这是一个已知问题。默认openstack mtu太小,所以docker mtu至少要改成1450。
    猜你喜欢
    • 1970-01-01
    • 2019-04-08
    • 2020-07-13
    • 1970-01-01
    • 2014-11-06
    • 2020-11-11
    • 2023-02-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多