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
docker swarm model networks support --network host
or not?
#25873
Comments
--network host
or not?--network host
or not?
@thaJeztah
We REALLY need '--net host' in Docker Swarm, because iptables's NAT module is missing in out company, for security reasons.
So, '--net host' may be our only hope now. And we don't have the load balance requirement too. |
I'd find this useful as well, mostly for running high performance things. We use swarm to schedule one database container per host with --net=host and not having this option is holding us back from using 1.12's services (which we'd really like because of the update/rolling restart feature). |
The corresponding issue in SwarmKit is moby/swarmkit#989. |
please close it as the swarmkit moby/swarmkit#989 is created |
@xiaods I think it's ok to keep this open for the docker side |
@theJeztah Does docker has any road plan for swarm mode to support host network? |
@rootsongjc this is the issue tracking it, also see the swarm kit issue linked above (moby/swarmkit#989) that has more details on the current status |
Already wrote this in #25303 but adding it here as well for easy reference. +1 on network=host. The lack of this option is basically a showstopper for me since my application connect out to a specific hardware unit using TCP. The unit then send data back using UDP to the originating IP address for the TCP connection. This works well in docker run with net=host but of course fail using the docker0 bridge in swarm mode. |
+1 for the need of host mode. The overlay network of swarm mode has performance penalty |
+1 for host mode @swarm |
+1 for exposing host network namespace to a swarm service |
+1 for host mode @swarm |
Yes we need this too, because without it it is not possible to dynamically add host network devices (VIP's) from inside a container through swarm service configuration. |
+1 |
2 similar comments
+1 |
+1 |
#32981 is addressing this requirement. |
still not supported in yml files afaik - works in |
+1 |
@thaJeztah I already tried that, I got "container cannot be disconnected from host network or connected to host network" |
@mmariani are you trying to publish a port (does your service have the |
@thaJeztah thanks, the The similar |
works for me with Thanks to @thaJeztah |
@thaJeztah |
I re-tested this on Docker 17.10, and this should now work (see my previous example in #25873 (comment)) @realcbb if the example I gave doesn't work on the latest 17.06.x EE release, please contact your support representative |
@thaJeztah in 17.11-ce deploying a Swarm Mode stack via docker-compose v3.3 I am getting this error. In my case I also have
|
@svscorp can you check if you're publishing a port for a service connected to the host network? When using host networking, you can't publish ports (any port exposed by the service is accessible, because it's running directly on the host's network stack); that error message is printed in that case |
Hi @thaJeztah thank you for quick response. Okay, now I see - my mistake. You are right. May I ask one more question then, if I want to attach a service (nginx in my case) to two networks - host and a custom overlay (to have services talking to each other across the Swarm). Is my assumption correct - I should be able to access a service on exposed port(s) directly accessing the node AND other services can connect to this "host service" thru the overlay normally? UPD: I got "container sharing network namespace with another container or host cannot be connected to any other network" :) Apparently my question above is obsolete. What I am trying to achieve is to have 2-3 "frontend" nodes where I will spin open-source "nginx" image that will serve as a reverse-proxy for backend services. I ran into the routing mesh situation, when request comes to frontend-node-1 but then routes to nginx container running on frontend-node-2. I need to lock requests coming to node-1 to be served by nginx running on node-1, and same for node-2. Plus, I want other backend services to be able to reach nginx service via service-name. |
@thaJeztah Thank you for providing that way to use host network in docker compose file! But when I did docker stack deploy to swarm, only the master machine is good to run. Other machines on swarm will show the error "only one instance of "host" network is allowed". So if host network is only allowed in one machine, the docker compose file for swarm will be useless, since I can do docker run on one machine. |
spent a few hours on this, and it does not seem to work in docker for mac! Worked fine on linux though, after i removed the |
|
Host network works in Mac. Though, one has to set routing requests to the docker VM |
This container doesn't need networking, but swarm is reluctant to start it without a proper swarm network defined. moby/moby#25873
In
with |
First of all, the docker swarm model is very convenient for us, easy to use and deploy.
But our application need share host network witch swarm model is not support now.
The reason why we need share host network is:
We need the
--network host
model badly, it is the simplest way to solve all the problems of us,and the achieve best performance.@thaJeztah
The text was updated successfully, but these errors were encountered: