This verifies that the nginx container is now running on the host network. You will find that now the container’s list has the nginx container details inside it. Now, inspect the host network using the following command. You will find that the list of ports for the nginx container is empty. To check whether the host network is using port mapping or not, list the containers to get the details of the ports. Inside the browser, copy this IP address and you can verify that the nginx container is running successfully. Use the below command to get the container Id.
#Docker network inspect driver#
We do not specify port mapping while using the host network because the host network driver automatically uses the “eth0” when running on linux/unix systems. sudo docker container run −d −−network host −−name nginx01 nginx−alpine We will now create a nginx Docker Container with the host network. Note that the Containers object is initially empty. You will get a json list with all the details about the network. Try to inspect that network using the following command. You will find a network with the name host and driver name as host with the scope as local. Before creating a nginx container, let’s list all the available networks. To understand them better, let’s create a nginx container with the help of host networking. In the case of a bridge network, it requires port mapping to communicate. In case of a host network, a particular Docker Container can directly use the Networking of the host for sending and receiving the packets. Single−host networks mean that their effect is local to each individual host. There are two types of single−host networks available for Docker Networking - “host” and “bridge” networks.