我正在尝试在 Azure 容器实例中设置 pi-hole。这是 docker-compose 的链接圆周率孔文件。
遵循YAML reference对于 Azure 容器实例,我正在尝试转换此 docker-compose 文件。
这是我填充的 YAML 文件。
name: pi-hole
apiVersion: '2018-10-01'
location: westus2
tags: {}
properties:
containers:
- name: pihole
properties:
image: pihole/pihole:latest
ports:
- protocol: TCP
port: 53
- protocol: UDP
port: 53
- protocol: UDP
port: 67
- protocol: TCP
port: 80
- protocol: TCP
port: 443
environmentVariables:
- name: TZ
value: Asia/Kolkata
resources: # Resource requirements of the instance
requests:
memoryInGB: 1
cpu: 1
restartPolicy: Always
ipAddress:
ports:
- protocol: TCP
port: 53
- protocol: UDP
port: 53
- protocol: UDP
port: 67
- protocol: TCP
port: 80
- protocol: TCP
port: 443
type: public
dnsNameLabel: my-pihole
osType: Linux
当我为相同的端口提供不同的协议(protocol)(TCP 53 和 UDP 53)时,就像在 docker-compose 文件中给出的那样,容器组的创建失败并出现以下错误
> az container create -g myResourceGroup -f container.yaml
Duplicate ports '53' found in container group 'pi-hole' container 'pihole'.
我应该如何输入端口来配置 TCP 和 UDP 中的端口 53,如示例 docker-compose 文件。
最佳答案
不幸的是,ACI 暴露到 Internet 的端口应该是唯一的,这意味着该端口只能出现一次。我知道您希望端口 53 同时允许 TCP 和 UDP 协议(protocol),但目前 ACI 不支持。
如果您不介意,VM 可以帮助您实现目的。
关于azure - 在 Azure 容器实例中使用不同协议(protocol)配置相同端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61053139/