Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions core/testcontainers/core/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,15 +226,17 @@ def get_container_host_ip(self) -> str:
connection_mode: ConnectionMode
connection_mode = self.get_docker_client().get_connection_mode()

# mypy:
container = self._container
assert container is not None

if connection_mode == ConnectionMode.docker_host:
return self.get_docker_client().host()
elif connection_mode == ConnectionMode.gateway_ip:
# mypy:
container = self._container
assert container is not None
return self.get_docker_client().gateway_ip(container.id)
elif connection_mode == ConnectionMode.bridge_ip:
# mypy:
container = self._container
assert container is not None
return self.get_docker_client().bridge_ip(container.id)
else:
# ensure that we covered all possible connection_modes
Expand Down