Search code examples
azureubuntudockerdocker-swarmazure-container-service

Cannot connect docker swarm agent from outside internet


I try to provide Python Flask (port 5000) on Docker swarm by Azure Container Service.

The deployed agent can be connected by curl 0.0.0.0:5000 from swarm management but cannot connect from outside of internet.

The port 5000 is well defined in agent Azure load balancer. What else can I inspect more?

I launch flask by follwing command.

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

The result of docker ps is as below. bbb/web is what I want to serve.

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

The result of docker network ls is as below

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

The result of docker info is as below

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

Solution

  • Man, forgive my stupidity.

    I missed to make ssh tunnel. It was run on my local machine actually.

    ssh -L 2375:localhost:2375 -f -N [email protected] -p 2200
    export DOCKER_HOST=:2375