Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker container not connecting to https endpoints

From inside a docker container, I'm running

# openssl s_client -connect rubygems.org:443 -state -nbio 2>&1 | grep "^SSL"     

SSL_connect:before/connect initialization
SSL_connect:SSLv2/v3 write client hello A
SSL_connect:error in SSLv2/v3 read server hello A

That's all I get

I can't connect to any https site from within the docker container. The container is running on an openstack vm. The vm can connect via https.

Any advice?

UPDATE

root@ce239554761d:/# curl -vv https://google.com
* Rebuilt URL to: https://google.com/
* Hostname was NOT found in DNS cache
*   Trying 216.58.217.46...
* Connected to google.com (216.58.217.46) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):

and then it hangs.

Also, I'm getting intermittent successes now.

Sanity Checks:

  • changing the docker ips doesn't fix the problem

  • The docker containers work on my local machine

  • The docker containers work on other clouds

  • Docker 1.10.0 doesn't work in the vms

  • Docker 1.9.1 works in the vms

like image 697
Peter Klipfel Avatar asked Feb 09 '16 19:02

Peter Klipfel


People also ask

Why can’t I connect to my Docker containers?

If you see Name or service not known you cannot connect to that container by using its name. If your containers are on the default Docker network, you can create a network with: Subsequently, you can attach your containers to this network, as shown in the previous section.

How to run multiple Docker containers on one network?

From the page https://success.docker.com/article/multiple-docker-networks Docker only allows a single network to be specified with the docker run command. To connect multiple networks "docker network connect" is used to connect additional networks.

How do I use localhost with Docker containers?

Docker provides a host network which lets containers share your host’s networking stack. This approach means localhost inside a container resolves to the physical host, instead of the container itself. Containers are launched with the host network by adding the --network=host flag: Now your container can reference localhost or 127.0.0.1 directly.

What is inter-container communication in Docker?

In Docker, the setting responsible for this is called inter-container communication, or ICC. If the output is false, ICC is disabled, and containers in that network cannot communicate with each other. The output can also be empty, in which case ICC is enabled because that's the default.


1 Answers

I was given a solution by the Docker community

OpenStack network seems to use lower MTU values and Docker does not infer the MTU settings from the host's network card since 1.10.

To run docker daemon with custom MTU settings, you can follow this blog post, that says:

$ cp /lib/systemd/system/docker.service /etc/systemd/system/docker.service

Edit a line in the new file to look like this:

ExecStart=/usr/bin/docker daemon -H fd:// --mtu=1454

MTU of 1454 is the value that seems to be common with OpenStack. You can look it up in your host using ifconfig.

Finally restart Docker:

$ sudo systemctl daemon-reload
$ sudo service docker restart
like image 199
Tarnschaf Avatar answered Sep 23 '22 02:09

Tarnschaf