title: Publish port in Docker Swarm host network
body: <p>I created a docker swarm cluster with docker-18.03.1-ce.</p>
  
  <p>When I deploy kafka container, I see code in stack.yml like this:</p>
  
  <pre><code>  kafka:
      image: wurstmeister/kafka:2.11-2.0.0
      ports:
        - target: 9094
          published: 9094
          protocol: tcp
          mode: host
  </code></pre>
  
  <p>But in docker's network architecture article(<a href="https://success.docker.com/article/networking" rel="nofollow noreferrer">https://success.docker.com/article/networking</a>), it says 'With the host driver, Docker does not manage any portion of the container networking stack such as port mapping or routing rules. This means that common networking flags like -p and --icc have no meaning for the host driver. They are ignored.'</p>
  
  <p>I am confused whether published ports will take effect in Swarm host network?</p>
  
  <p>Does anyone know about this?</p>