在 Azure 容器实例中使用不同的协议配置相同的端口

Configuring same ports with different protocols in Azure Container Instance

我正在尝试在 Azure 容器实例中设置 pi-hole。这是pi-hole的link到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 文件一样。

遗憾的是,ACI暴露在互联网上的端口应该是唯一的,也就是说该端口只能出现一次。我知道你想要端口 53 同时允许 TCP 和 UDP 协议,但它目前在 ACI 中不支持。

如果你不介意的话,VM可以帮你达到目的