Docker container accesses host database service

after I use docker network create mynet,
connects to the (docker run on this docker network when creating containers-- net mynet),
so that docker containers can access each other through hostname to avoid writing dead IP.

my doubt is that
on the docker host, a service is enabled to listen on the internal network card eth1, 10.3.3.3eth1 1025,
so how can the container access this service of the host? Try to avoid writing dead IP?

Mar.02,2021

the host runs ip-4 addr show docker0 | grep-Po 'inet K [d] +'. The container can use this IP to access the host.
you can use host.docker.internal

from 18.03onwards.
Menu