getting dial tcp: i/o timeout when accessing internet from a service inside a container
I was to solve this error by including Google DNS (8.8.8.8) in my machine's nameservers. I think this error was due to the slow domain resolution process as my machine was getting DNS from DHCP.
I followed these steps:
Set static DNS in
/etc/resolvconf/resolv.conf.d/base
file:nameserver 8.8.8.8
nameserver 8.8.4.4Configure your PC so that it uses user-provided DNS, instead of obtaining it from DHCP. For that, open this file
/etc/dhcp/dhclient.conf
and add this line:supersede domain-name-servers 8.8.8.8, 8.8.4.4;
Restart network manager using:
sudo service network-manager restart
Amit Chahar
Updated on June 15, 2022Comments
-
Amit Chahar almost 2 years
I am using PubNub (GO SDK) publish/subscribe service to receive messages but I am not receiving any messages even when I am able to ping
google.com
from inside the container.In the Pubnub logs, every time my program tries to connect to the origin (Pubnub server), I am getting "dial tcp: i/o timeout" error. I guess this is due to the slow internet connection either on the host or in the container.
What should I do to get around this error?