outposts: fix outpost being re-created when in host mode
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
a3ff7cea23
commit
b8bdf7a035
|
@ -56,9 +56,15 @@ class DockerController(BaseController):
|
||||||
def _comp_ports(self, container: Container) -> bool:
|
def _comp_ports(self, container: Container) -> bool:
|
||||||
"""Check that the container has the correct ports exposed. Return true if container needs
|
"""Check that the container has the correct ports exposed. Return true if container needs
|
||||||
to be rebuilt."""
|
to be rebuilt."""
|
||||||
|
# with TEST enabled, we use host-network
|
||||||
|
if settings.TEST:
|
||||||
|
return False
|
||||||
|
# When the container isn't running, the API doesn't report any port mappings
|
||||||
|
if container.status != "running":
|
||||||
|
return False
|
||||||
# {'6379/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '6379'}]}
|
# {'6379/tcp': [{'HostIp': '127.0.0.1', 'HostPort': '6379'}]}
|
||||||
for port in self.deployment_ports:
|
for port in self.deployment_ports:
|
||||||
key = f"{port.inner_port or port.port}/{port.protocol}"
|
key = f"{port.inner_port or port.port}/{port.protocol.lower()}"
|
||||||
if key not in container.ports:
|
if key not in container.ports:
|
||||||
return True
|
return True
|
||||||
host_matching = False
|
host_matching = False
|
||||||
|
|
Reference in New Issue