Description
To prove this ,I did two tests;
case 1:
This is a part of configuration of marathon:
"cmd": "python -m SimpleHTTPServer $PORT0",
"container": {
"type": "DOCKER",
"volumes": [],
"docker": {
"image": "qihoo.cloud/cloud/x4python:1.0.0",
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 2000,
"hostPort": 0,
"servicePort": 2000,
"protocol": "tcp",
"labels": {}
}
],
"privileged": false,
"parameters": [],
"forcePullImage": false
}
},
"labels":
,
After launch success,I tried to access haproxy port 2000,but there was no result returned,Then I checked the runtime status, The relevant information is follows:
Marathon Endpoints: mesos20.xxx.xxx.xxx.xxx:63132
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c85ff0427da4 cloud/x4python:1.0.0 "/bin/sh c 'pytho..." 7 minutes ago Up 7 minutes 0.0.0.0:63132>2000/tcp mesos-fc86fdb5-7a6f-4ba4-96d3-d082fcfc1236-S21.4c242985-3967-44ed-8c5d-4844ec0733c0
# docker exec -it c85ff0427da4 bash
[root@c85ff0427da4 ~]# netstat -atunp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:63132 0.0.0.0:* LISTEN 1/python
case 2:
I tried to update the configuration of app, and assigned containerPort to 0, then repeated the above operations:
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 0,
"hostPort": 0,
"servicePort": 2000,
"protocol": "tcp",
"labels": {}
}
]
# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b43e84644a8a cloud/x4python:1.0.0 "/bin/sh c 'pytho..." About a minute ago Up About a minute 0.0.0.0:18797>18797/tcp mesos-fc86fdb5-7a6f-4ba4-96d3-d082fcfc1236-S21.1a0bfb53-1fb8-41db-98c9-6d4714587085
Then I accessed the service by haproxy port 2000,service is ok, that's what I expected; So I think that there is a bug in the first case was triggered, Looking forward to a reply,thanks.