I am trying to run a container where I need to user network driver as "host" instead of "bridge". I am running it on Centos machine and my docker-compose.yml is
version: '3.4' services: testContainer: build: context: . args: HADOOP_VERSION: 2.6.0 HIVE_VERSION: 1.1.0 image: testcontainer container_name: testcontainer hostname: testcontainer ports: - 9200:9200 - 9300:9300 - 5601:5601 - 9001:9001 ulimits: memlock: soft: -1 hard: -1 networks: - elknet networks: elknet: driver: host
But i am getting the following error when I fire "docker-compose up" :
ERROR: only one instance of "host" network is allowed
Can anyone please suggest how can I use host network using docker-compose.yml.
Source: Docker Questions