Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 2 additions & 5 deletions testcontainers/core/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from testcontainers.core.docker_client import DockerClient
from testcontainers.core.exceptions import ContainerStartException
from testcontainers.core.utils import is_windows, inside_container
from testcontainers.core.utils import inside_container


class DockerContainer(object):
Expand Down Expand Up @@ -81,10 +81,7 @@ def get_container_host_ip(self) -> str:
# container's IP address from the dockder "bridge" network
if inside_container():
return self.get_docker_client().bridge_ip(self._container.id)
elif is_windows():
return "localhost"
else:
return "0.0.0.0"
return "localhost"

def get_exposed_port(self, port) -> str:
if inside_container():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_new_docker_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def test_docker_env_variables():
db.with_bind_ports(3306, 32785)
with db:
url = db.get_connection_url()
assert url == 'mysql+pymysql://demo:test@0.0.0.0:32785/custom_db'
assert url == 'mysql+pymysql://demo:test@localhost:32785/custom_db'


def test_docker_kargs():
Expand Down