azure - 在 Azure 容器实例中使用不同协议(protocol)配置相同端口

标签 azure docker azure-container-instances

我正在尝试在 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/

相关文章:

docker - 如何在 docker v2 中指示 azureSubscriptionEndpoint

c# - 在 ASP.NET Core Web Api 中将初始化步骤放在哪里?

google-app-engine - 是否有云/集群/托管提供商按实际使用的 CPU 时间收费?

bash - Docker osx挂载文件夹为空

user-interface - 用于创建 Azure 数据库表的 GUI

azure - 在 aks 或 aci 中部署后如何编辑 Azure ML 条目或评分脚本文件

azure - 为容器 Web 应用程序中的每个容器分配了多少内存和 CPU?

azure - Kubernetes 虚拟节点池虚拟机意外费用

azure - 如何更新 azure 应用程序注册应用程序属性?

azure - 无法通过 terraform 和 AZ CLI 使用 Standard3 高密度 SKU 创建 Azure 搜索服务,但出现错误