我正在尝试使用python SDK获得docker服务 . 我的服务是一个nginx容器,它应该将容器80端口绑定到机器80端口 . nginx配置具有针对https的所有http流量的重定向子句 .

启动服务时,我使用以下参数:

params = {
        'endpoint_spec': docker.types.EndpointSpec(ports={80: 80}),
        'name': name,
        'hostname': name,
        'image': NGINX_IMAGE_NAME,
        'networks': [NETWORK_NAME],
        'mounts': ['/home/ubuntu/.ssh/certs:/certs:ro'],
        'log_driver': 'syslog',
        'log_driver_options': {'syslog-address': 'udp://localhost:514'},
        'constraints': ['node.labels.environment==test']
    }
api.services.create(**params)

我期待的行为是80个端口暴露在环境实验室设置为测试的所有节点上 . 我得到的是在docker swarm中所有节点上打开的80端口 . 这是有意的吗?可以限制绑定到特定节点吗?

编辑:

显然the docker ingress network对我的困境负责 . 有关如何禁用此特定行为的任何提示?