How to access an intranet service from inside docker container?

My company has a mail server which is only available to our local network, i.e mail.example.com => 172.18.0.3. Because docker will create a private subnet for containers, even though mail.example.com can still be resolved to 172.18.0.3 inside the container, that IP address can’t be reached.

I’m looking for a way to do this:

  • Using docker-compose configuration only if possible
  • Still using bridge network