Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

187
Views
Docker for Mac: Host network and port publishing

I am running Docker for Mac. When I run

docker run -d --rm --name nginx -p 80:80 nginx:1.10.3

I can access Nginx on port 80 on my Mac. When I run

docker run -d --rm --name nginx --network host -p 80:80 nginx:1.10.3

I can not.

Is it possible to use both "--network host" and publish a port so that it is reachable from my Mac?

Alternatively, can I access Nginx from my Mac via the IP of the HyperKit VM?

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Without the --network flag the container is added to the bridge network by default; which creates a network stack on the Docker bridge (usually the veth interface).

If you specify --network host the container gets added to the Docker host network stack. Note the container will share the networking namespace of the host, and thus all its security implications.

Which means you don't need to add -p 80:80, instead run...
docker run -d --rm --name nginx --network host nginx:1.10.3

and access the container on http://127.0.0.1

The following link will help answer the HyperKit question and the current limitations:
https://docs.docker.com/docker-for-mac/networking/

There is no docker0 bridge on macOS

Because of the way networking is implemented in Docker for Mac, you cannot see a docker0 interface in macOS. This interface is actually within HyperKit.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!