Hello
I’m really new to docker. I created an debian stretch image from scratch. that I can run in docker.
Now I’m going to learn docker networking (read the docs). But till now I didn’t find an answer to the question if a docker image/container need it’s own network interface. For example
auto lo
iface lo inet loopback
allow eth0
iface eth0 inet dhcp
allow eth1
iface eth1 inet static
…
Or if I can create an image/container without any networking tools in it and will still have network
possibilities in such a container using docker run options.
You do not need to explicitly configure networking in your containers; they do not need their own network interfaces; when they start up Docker will have already established their network environment.
The two important things to read up on are the docker run -p option, which publishes a port so that the container can be reached from the host system, and Docker’s internal DNS system, which allows containers to talk to each other by name.
Containers happen to have private IP addresses but these addresses are basically useless and (contrary to many write-ups out there, including some official Docker docs) there’s almost no reason to ever try to find them.
From the point of view of other hosts on your network, a service like Apache running in a Docker container is indistinguishable from an Apache running outside a container directly on your host: you’d reach the container via the host’s DNS name or IP address and a configured TCP port. Neither the Docker container nor the host server process has an IP address distinct from the host’s.