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

--network host not resolving to Docker Desktop host #87

Open
3 tasks done
ReubenFrankel opened this issue Oct 19, 2022 · 4 comments
Open
3 tasks done

--network host not resolving to Docker Desktop host #87

ReubenFrankel opened this issue Oct 19, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@ReubenFrankel
Copy link

ReubenFrankel commented Oct 19, 2022

  • I have tried with the latest version of Docker Desktop
  • I have tried disabling enabled experimental features
  • I have uploaded Diagnostics
  • Diagnostics ID: bdfdb712-7db3-4101-ba47-3b9f28955471/20221019094322

Expected behavior

  • localhost/127.0.0.1 resolves to Docker Desktop host with --network host

Actual behavior

  • localhost/127.0.0.1 does not resolve to Docker Desktop host with --network host
  • host.docker.internal does resolve to Docker Desktop host with --network host

image

Information

  • Linux distro: Ubuntu
  • Distro version: 22.04.1 LTS
  • Docker Desktop Version: 4.12.0 (85629)

I've been having this problem for a while now, so isn't version-specific AFAIK. I am aware Docker Desktop runs a Linux VM, so (I think) --network host is resolving to the VM network instead of the host OS network. I was under the impression that this should work after reading this blog post - specifically:

Seamless plumbing into the host OS giving containers access to the filesystem and networking

or I might just be missing something fundamental. 😅

Steps to reproduce the behavior

  1. python -m http.server 8080
  2. docker run --rm --network host alpine sh -c 'apk add curl -q && curl -sv -o /dev/null http://localhost:8080'
@docker-robott
Copy link
Collaborator

There hasn't been any activity on this issue for a long time.
If the problem is still relevant, mark the issue as fresh with a /remove-lifecycle stale comment.
If not, this issue will be closed in 30 days.

Prevent issues from auto-closing with a /lifecycle frozen comment.

/lifecycle stale

@ReubenFrankel
Copy link
Author

/remove-lifecycle stale

@hissssst
Copy link

I have exactly the same issue

@darkship
Copy link

I have this issue too since I use docker desktop with docker compose.

The easiest and recommended way to get Docker Compose is to install Docker Desktop.

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

No branches or pull requests

5 participants