Docker Community Forums

Share and learn in the Docker community.

Docker network host


we are using docker host network . so when my application is connect to external network using outbound connection some times it is getting socket time out . we didn’t see this behavior in normal app(without container) .

so I am thinking am I missed any settings or configurations ? i am using host network only

if i use host network how the behavior of IPtables ? we dont setup any IPtables at host level .

how the packet transformation will happen in host network ?

network=host literaly makes the container hook into the host’s networks namespace and is network-wise like every other native process on the host.

It high likely that your observation is coincidental and will happen, under the same curcumstances (same machine, same process), with the process beeing run as a native process as well.

Create and start the container as a detached process. The --rm option means to remove the container once it exits/stops. The -d flag means to start the container detached (in the background).

docker run --rm -d --network host --name my_nginx nginx
Access Nginx by browsing to http://localhost:80/.

Examine your network stack using the following commands:

Examine all network interfaces and verify that a new one was not created.

ip addr show
Verify which process is bound to port 80, using the netstat command. You need to use sudo because the process is owned by the Docker daemon user and you otherwise won’t be able to see its name or PID.

sudo netstat -tulpn | grep :80
Stop the container. It will be removed automatically as it was started using the --rm option.

docker container stop my_nginx

Hi thanks for info ,
but in my case some times route is established and some times it is getting timed out . i wonder if there is any route issues or settings in IPtables