• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

431
Views
Docker: cannot link containers in --net=host mode

I have a Couchbase server container named db launched with --net=host option which exposes port 11210, and now I have to link another container to it. If I use the --link option while running my new container, that is type:

docker run -d -P --name my_name --link db:db my_image

I get:

Error response from daemon: Conflicting options: host type networking can't be used with links. This would result in undefined behavior.

How can I solve this?

about 3 years ago · Santiago Trujillo
1 answers
Answer question

0

You can't.

"Linking" containers doesn't make any sense when using --net=host. When you link containers, Docker creates entries in /etc/hosts so that the containers can connect to each other by name, but when using --net=host your containers do not have unique addresses. They are sharing the host network environment.

You can just use localhost to access services running in either container, or any valid address on your host (assuming that your service is configured to listen on all available addresses).

about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error