Docker compose, running containers in net:host
<p>I want to spawn 3 services in the &quot;host&quot; net using docker-compose. Here is my docker-compose.yml file:</p>
<pre><code>version: '2'
services:
  mysql:
    image: mysql
    net: &quot;host&quot;
  nginx:
    image: nginx
    net: &quot;host&quot;
  app:
    image: tomcat
    net: &quot;host&quot;
</code></pre>
<p>I got the following error:</p>
<pre><code>$ docker-compose up
[31mERROR[0m: Validation failed in file '.\docker-compose.yml', reason(s):
Unsupported config option for services.app: 'net'
Unsupported config option for services.mysql: 'net'
Unsupported config option for services.nginx: 'net'
</code></pre>
<p>I'm using boot2docker on windows.</p>
<p>Docker, and Docker-compose version:</p>
<pre><code>$ docker -v
Docker version 1.10.2, build c3959b1
$ docker-compose -version
docker-compose version 1.6.0, build cdb920a
</code></pre>
<p>If I run all services manually by using <code>docker run --net = &quot;host&quot;</code> everything is working fine.</p>
<p>In the documentation I read that <strong>net</strong> command is <strong>supported in docker-compose</strong>:</p>
<blockquote>
<p><strong>net</strong></p>
<p>Networking mode. Use the same values as the docker client --net parameter.</p>
<p>net: &quot;bridge&quot;</p>
<p>net: &quot;none&quot;</p>
<p>net: &quot;container:[name or id]&quot;</p>
<p>net: &quot;host&quot;</p>
</blockquote>
<p><a href="https://docs.docker.com/v1.6/compose/yml/#net" rel="noreferrer">https://docs.docker.com/v1.6/compose/yml/#net</a></p>
<p>What am I doing wrong?</p>