Docker Community Forums

Share and learn in the Docker community.

ERROR: only one instance of "host" network is allowed


(Biot023) #1

Hi – I’m having difficulty with using the host network driver.
I have a networks section at the end of my docker-compose.yml file:

version: "3"
services:
    ...
networks:
    default:
        driver: host

However, when I try to run this with docker-compose up I get this error:

Creating network “0_dev_default” with driver “host”
ERROR: only one instance of “host” network is allowed

There aren’t any other containers running when I do a docker ps or anything.
Can anyone advise me on what I’m getting wrong?
Thanks for any and all assistance,
Doug.


(Dekoy) #2

Hello,

Have you found a solution to this or do you still need help?


(Ballack) #4

Hello,
I have the same problem.
My docker-compose.yml :
version: ‘2’
services:

   nginx:
     image: myapp/nginx:v1.14
     ports: 
       - "80:80"
       - "443:443"
     networks: 
       - "host"
   
   mysql:
     image: myapp/mysql:v5.7.24
     ports: 
       - "3306:3306"
     networks: 
       - "host"

 networks:
   host:
     driver: host

When I run command “docker-compose up” display error is as follow

Creating network “docker_host” with driver “host”
ERROR: only one instance of “host” network is allowed

How should me solve the problem?


(Maksimluzik) #5

Had same issue, looks like that you can not have 2nd host driver network as Docker by default has one created already. Thus you would need just to use it instead of creating new network. Just add:
network_mode: host under your container