无法从外部互联网连接docker swarm agent

时间:2017-06-17 06:43:02

标签: azure ubuntu docker docker-swarm azure-container-service

我尝试通过Azure容器服务在Docker swarm上提供Python Flask(端口5000)。

部署的代理可以通过curl 0.0.0.0:5000从群组管理进行连接,但无法从互联网外部进行连接。

端口5000在代理Azure负载均衡器中定义良好。还有什么可以检查更多?

我通过以下命令启动烧瓶。

docker run -d -p 5000:5000 bbb/web /root/startScript.sh

docker ps的结果如下。 bbb/web是我想要服务的。

CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                                                                                                                                NAMES
05a96351290c        bbb/web       "/root/startScript.sh"   43 minutes ago      Up 43 minutes       0.0.0.0:5000->5000/tcp                                                                                                               jovial_meitner
adcc2d45cbe0        swarm:1.1.0         "/swarm manage --repl"   8 months ago        Up 7 weeks          0.0.0.0:2375->2375/tcp                                                                                                               containers_swarm_1
2264e2b1636f        progrium/consul     "/bin/start -server -"   8 months ago        Up 7 weeks          0.0.0.0:8300-8302->8300-8302/tcp, 0.0.0.0:8400->8400/tcp, 53/tcp, 53/udp, 0.0.0.0:8500->8500/tcp, 0.0.0.0:8301-8302->8301-8302/udp   containers_consul_1

docker network ls的结果如下

NETWORK ID          NAME                DRIVER              SCOPE
66bf169bd8f9        bridge              bridge              local               
2aeb61431acf        host                host                local               
19448e290e2c        none                null                local    

docker info的结果如下

Containers: 5
Running: 3
Paused: 0
Stopped: 2
Images: 3
Server Version: 1.12.2
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 48
Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: overlay null host bridge
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Security Options: apparmor
Kernel Version: 3.19.0-65-generic
Operating System: Ubuntu 14.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 3.36 GiB
Name: swarm-master-A501B991-0
ID: KKRP:45CG:NSBD:EUP5:PDGV:S3QA:4UUJ:NUIS:YP7I:DBLM:GSXU:47SC
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Username: bbb
Registry: https://index.docker.io/v1/
WARNING: No swap limit support
Insecure Registries:
127.0.0.0/8

2 个答案:

答案 0 :(得分:1)

男人,原谅我的愚蠢。

我错过了制作ssh隧道。它实际上是在我的本地机器上运行的。

ssh -L 2375:localhost:2375 -f -N myname@dockertestmgmt.eastasia.cloudapp.azure.com -p 2200
export DOCKER_HOST=:2375

答案 1 :(得分:0)

可能是您没有正确打开端口5000,例如缺少NSG。请参阅https://docs.microsoft.com/en-us/azure/container-service/container-service-enable-public-access(该文档涉及DC / OS,但过程相同)。