Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker containers don't listen to host.docker.internal #614

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

atzoum
Copy link
Collaborator

@atzoum atzoum commented Aug 30, 2024

Description

host.docker.internal in linux, by default, resolves to 172.17.0.1

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@atzoum atzoum changed the title fix: docker should bind to all IPv4 addresses, including host.docker.internal fix: docker containers don't listen to host.docker.internal Aug 30, 2024
@atzoum atzoum merged commit 7df95c9 into main Aug 30, 2024
15 checks passed
@atzoum atzoum deleted the fix.bindhostip branch August 30, 2024 08:39
@@ -4,7 +4,7 @@ import (
"github.com/ory/dockertest/v3/docker"
)

const BindHostIP = "127.0.0.1"
const BindHostIP = "0.0.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0.0.0.0 would be corresponding to all the interfaces(including IPV6), we can introduce a new ip for 172.17.0.1

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

host.docker.internal doesn't always resolve to the same ip...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of Docker Desktop for Mac, this causes issues :(

API error (500): driver failed programming external connectivity on endpoint thirsty_napier (78e1f6fa6a0132e1f00cbadbb20ef86b89d7cdc55ddd6828c0eb7bbc9516d67a): failed to bind port 127.0.0.1:55053/tcp: listen tcp4 127.0.0.1:55053: bind: address already in use

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mihir20 the only way I can think right now is in #616

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants