Docker and the "host" network:

In the "host" network setup, the container will use the IP address of the network stack of its host, so we don't have to expose any ports:


We could run an "nginx" container with a "host" network using the below command:


We use the below command to check if the container is running :


Since "nginx" listens on port 8080, we will have that port open on the host, and we can access our "nginx" container through a browser for example, using the address : "http://host_ip:8080"

Docker and the "bridge" network:


To use the default "bridge" networking with our "nginx" container, we will use the below command:


We could also verify that our container is running using the below command: 


We could also see both ports in the output of the command.
Brando Sabatini and Ikbal C ©. Powered by Blogger.