title: How to use host network for docker compose?
body: <p>I want to use docker compose with the host network. </p>
  
  <p>I have a docker container that access a local REST api.  Usually I run </p>
  
  <pre><code>docker run --net=host -p 18080:8080 -t -i containera
  </code></pre>
  
  <p>which can access the host REST api which runs at <code>http://127.0.0.1:8080</code>. Since I want to scale the container <code>containera</code> I found docker compose to scale the container. But the docker compose file from the <a href="https://docs.docker.com/get-started/part3/" rel="noreferrer">documentation</a> does not work. The docker container does not query the REST API. </p>
  
  <p>I tried the following compose file but the property</p>
  
  <pre><code>version: "3"
  services:
    web:
      image: conatinera:latest
      network_mode: "host"
      deploy:
        replicas: 1
        resources:
          limits:
            cpus: "0.5"
            memory: 4G 
        restart_policy:
          condition: on-failure
      ports:
        - "18080:8080"
  </code></pre>
  
  <p>but the property <code>network_mode</code> is ignored/not allowed.  with the message </p>
  
  <pre><code>Ignoring unsupported options: network_mode
  </code></pre>