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?
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With