Skip to content

Troubleshooting / Code Cannot Access the Internet

A Script cannot access the internet, mostly due to DNS or firewall issues.

Specifically, when a Script executes code such as requests.get('http://bing.com'), the following errors occur:

  1. Temporary failure in name resolution
  2. Connection refused
  3. Connection to bing.com timed out
  4. Other network errors

You can troubleshoot the issue by performing the following steps in order:

  1. On the host machine, run ping 8.8.8.8 to check whether the host machine can access the internet.
  2. On the host machine, run curl http://bing.com to check whether the host machine's DNS is working properly.
  3. Run docker exec -it {DataFlux Func Container ID} sh -c 'exec ping 8.8.8.8' to check whether the container can access the internet.
  4. Run docker exec -it {DataFlux Func Container ID} sh -c 'exec curl http://bing.com -i' to check whether the container's DNS is working properly.

8.8.8.8 is the address of a common public DNS server

If the installed DataFlux Func image does not include the ping command, you can use curl http://{IP Address} instead

Possible causes and solutions:

Possible cause Solution
The host cannot access the internet or DNS is not working properly Check and adjust the operating system network configuration
The container cannot access the internet or DNS is not working properly Check and adjust Docker-related configuration, and check the operating system network configuration if necessary

Docker DNS Configuration Reference

Edit the /etc/docker/daemon.json file, add the following content, save it, and restart the Docker service:

JSON
1
2
3
4
5
6
{
    "dns" : [
        "8.8.8.8",
        "8.8.4.4"
    ]
}