Skip to content

Troubleshooting / Code Cannot Access Specific Domains

In some cases, certain domains lack DNS resolution and require modifying the hosts file for access. You can achieve this by adding extra_hosts content to the server and all worker-xxx services in the docker-stack.yaml file.

The docker-stack.yaml file is located on the host machine at {DataFlux Func installation directory}/docker-stack.yaml

This configuration must be added to both the server and all worker-xxx services. Do not omit any.

The specific modification section is as follows:

YAML
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
services:
  server:
    extra_hosts:
      - "somehost:1.2.3.4"
      - "otherhost:5.6.7.8"
  worker-0:
    extra_hosts:
      - "somehost:1.2.3.4"
      - "otherhost:5.6.7.8"
  worker-1-6:
    extra_hosts:
      - "somehost:1.2.3.4"
      - "otherhost:5.6.7.8"
  worker-7:
    extra_hosts:
      - "somehost:1.2.3.4"
      - "otherhost:5.6.7.8"
  worker-8-9:
    extra_hosts:
      - "somehost:1.2.3.4"
      - "otherhost:5.6.7.8"

After adding the above configuration, it is equivalent to configuring the following content in /etc/hosts:

Text Only
1
2
somehost    1.2.3.4
otherhost   5.6.7.8

After modifying the configuration, please restart DataFlux Func