Docker Network port information are wrong
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Heat |
Expired
|
Undecided
|
Unassigned |
Bug Description
Docker plugin assume things about docker networkinfo which does not seem to exist in my latest docker version, for example this is the info we are getting from docker python binding about networking :
stack@devstack:~$ ipython
iPython 2.7.5+ (default, Feb 27 2014, 19:37:08)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import docker
In [2]: c = docker.Client()
In [3]: c.inspect_
c.inspect_container c.inspect_image
In [3]: i = c.inspect_
[...]
In [7]: i['NetworkSetti
Out[7]:
{u'Bridge': u'docker0',
u'Gateway': u'172.17.42.1',
u'IPAddress': u'172.17.0.2',
u'IPPrefixLen': 16,
u'PortMapping': None,
u'Ports': {u'3306/tcp': None}}
the Ports key is then coming back here:
u'Ports': {u'3306/tcp': None}}
when the code assume this :
https:/
if not info or len(p) != 2 or 'HostPort' not in info[0]:
which is nowhere to be seen in that dict and does not come back then with the ports.
A quick patch like that gets the ports properly listed :
diff --git i/contrib/
index 1b0fee8..cf67eba 100644
--- i/contrib/
+++ w/contrib/
@@ -153,9 +153,9 @@ class DockerContainer
udp = []
for port, info in networkinfo[
p = port.split('/')
- if not info or len(p) != 2 or 'HostPort' not in info[0]:
+ if len(p) != 2:
- port = info[0]['HostPort']
+ port = p[0]
if p[1] == 'tcp':
elif p[1] == 'udp':
I am not submitting that just yet because i am not sure if i am just using it wrong and handle some other case I don't see about (from looking at the sourcecode of docker python binding)
let me know what do you think.
Changed in heat: | |
status: | New → Incomplete |
IIUC, the code in Heat is correct, as it only return *exposed* ports, which is what the HostPort value gives you. If it's None, I think it means it's not exposed.