【问题标题】:Configuring same ports with different protocols in Azure Container Instance在 Azure 容器实例中使用不同的协议配置相同的端口
【发布时间】:2026-01-29 03:05:01
【问题描述】:

我正在尝试在 Azure 容器实例中设置 pi-hole。这是pi-hole的docker-compose文件的链接。

按照 Azure 容器实例的 YAML reference,我正在尝试转换此 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

当我为相同的端口提供不同的协议(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 文件一样。

【问题讨论】:

  • 还有问题吗?它解决了你的问题吗?如果它对你有用,请接受它。无论如何,只要给出回应。

标签: azure docker azure-container-instances


【解决方案1】:

很遗憾,ACI 暴露给 Internet 的端口应该是唯一的,这意味着该端口只能出现一次。而且我知道您希望端口 53 允许 TCP 和 UDP 协议,但它目前在 ACI 中不支持。

如果您不介意,VM 可以帮助您实现目标。

【讨论】:

  • 无赖。到目前为止,我已经删除了 TCP 条目。它现在工作正常
最近更新 更多