Exposed ports, env vars, volumes from the image.
This will account for settings that are provided by the hierarchy of Dockerfiles used to construct your image, rather than only accounting for settings provided to the module directly.
This commit is contained in:
parent
0d822c0c02
commit
959d135b60
1 changed files with 4 additions and 6 deletions
|
@ -808,9 +808,7 @@ class DockerManager(object):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# EXPOSED PORTS
|
# EXPOSED PORTS
|
||||||
# Note that ports that are bound at container run are also exposed
|
expected_exposed_ports = set((image['ContainerConfig']['ExposedPorts'] or {}).keys())
|
||||||
# implicitly.
|
|
||||||
expected_exposed_ports = set()
|
|
||||||
for p in (self.exposed_ports or []):
|
for p in (self.exposed_ports or []):
|
||||||
expected_exposed_ports.add("/".join(p))
|
expected_exposed_ports.add("/".join(p))
|
||||||
|
|
||||||
|
@ -824,7 +822,7 @@ class DockerManager(object):
|
||||||
# VOLUMES
|
# VOLUMES
|
||||||
# not including bind modes.
|
# not including bind modes.
|
||||||
|
|
||||||
expected_volume_keys = set()
|
expected_volume_keys = set((image['ContainerConfig']['Volumes'] or {}).keys())
|
||||||
if self.volumes:
|
if self.volumes:
|
||||||
for key, config in self.volumes.iteritems():
|
for key, config in self.volumes.iteritems():
|
||||||
if not config and key not in self.binds:
|
if not config and key not in self.binds:
|
||||||
|
@ -850,13 +848,13 @@ class DockerManager(object):
|
||||||
# actual_env is likely to include environment variables injected by
|
# actual_env is likely to include environment variables injected by
|
||||||
# the Dockerfile.
|
# the Dockerfile.
|
||||||
|
|
||||||
expected_env = set()
|
expected_env = set(image['ContainerConfig']['Env'] or [])
|
||||||
if self.env:
|
if self.env:
|
||||||
for name, value in self.env.iteritems():
|
for name, value in self.env.iteritems():
|
||||||
expected_env.add("{}={}".format(name, value))
|
expected_env.add("{}={}".format(name, value))
|
||||||
actual_env = set(container['Config']['Env'] or [])
|
actual_env = set(container['Config']['Env'] or [])
|
||||||
|
|
||||||
if not actual_env.issuperset(expected_env):
|
if actual_env != expected_env:
|
||||||
# Don't include the environment difference in the output.
|
# Don't include the environment difference in the output.
|
||||||
self.reload_reasons.append('environment')
|
self.reload_reasons.append('environment')
|
||||||
differing.append(container)
|
differing.append(container)
|
||||||
|
|
Loading…
Reference in a new issue