Docker cannot bind to ipv4 while using host network

  docker, docker-container, docker-network

I have a program which deploys on docker needs link to host network.So I run this commmand

docker run -d --network host demoProgram

The exposed port is 80 .
I found that it only bind ipv6 after entering the command

netstat -tnlp 

The result of the command was

tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      680/rpcbind
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1044/sshd
tcp6       0      0 :::3306                 :::*                    LISTEN      1097/mysqld
tcp6       0      0 :::111                  :::*                    LISTEN      680/rpcbind
tcp6       0      0 :::80                   :::*                    LISTEN      2052/dotnet
tcp6       0      0 :::22                   :::*                    LISTEN      1044/sshd
tcp6       0      0 :::33060                :::*                    LISTEN      1097/mysqld

What should I do to make the container bind ipv4?

Source: Docker Questions

LEAVE A COMMENT