I want to spawn 3 services in the "host" net using docker-compose. Here is my docker-compose.yml file:
version: '2'
services:
mysql:
image: mysql
net: "host"
nginx:
image: nginx
net: "host"
app:
image: tomcat
net: "host"
I got the following error:
$ 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'
I'm using boot2docker on windows.
Docker, and Docker-compose version:
$ docker -v
Docker version 1.10.2, build c3959b1
$ docker-compose -version
docker-compose version 1.6.0, build cdb920a
If I run all services manually by using docker run --net = "host"
everything is working fine.
In the documentation I read that net command is supported in docker-compose:
net
Networking mode. Use the same values as the docker client --net parameter.
net: "bridge"
net: "none"
net: "container:[name or id]"
net: "host"
https://docs.docker.com/v1.6/compose/yml/#net
What am I doing wrong?
network_mode: "host"
. As documented in docker compose version 3 #network_mode. – Gentlemanatarms