Can't reach Magic DNS of other device from inside Docker container

Hello everyone! I have 3 elements connected to Tailscale. My computer (no docker running here just Ubuntu 20) and two docker-compose clusters, each inside an AWS EC2 instances. This clusters are running two containers: one running Tailscale and the other one running a Jupyter Notebook.

The docker compose inside the EC2 instances looks like this:

services:

  tailscale:

    hostname: ${TAILSCALE_NAME}                         # This will become the tailscale device name
    image: tailscale:latest
    volumes:
        - "./tailscale_var_lib:/var/lib"        # State data will be stored in this directory
        - "/dev/net/tun:/dev/net/tun"           # Required for tailscale to work
    restart: always
    cap_add:                                    # Required for tailscale to work
      - net_admin
      - sys_module 

  jupyters:

    image: my_jupyter:latest

    init: true
    network_mode: service:tailscale
    env_file:
      - ./.tfenv
    restart: always

Lets say I have these 3 elements with names my_computer, docker1 and docker2. And a nameserver “examplecom” (with a dot before com but as a new user I can’t post it if it is interpreted as a link :sweat_smile:)

From my computers terminal these work:
ping docker1.example.com.beta.tailscale.net
ping docker1
ping 100.XXX.XXX.XXX (docker1s Tailscale IP address)

However, from inside the dockers I can only reach the other docker or my computer through their IPs, but when I try to ping them with their Magic DNS or their device name, I get a Name or service not known message.

For example if I’m inside any of the dockers of the device docker1 these two work:
ping 100.XXX.XXX.XXX (docker2s Tailscale IP address)
ping 100.XXX.XXX.XXX (my_computes Tailscale IP address)

And these won’t work:
ping docker2.example.com.beta.tailscale.net
ping docker2
ping my_computer.example.com.beta.tailscale.net
ping my_computer

I can even connect to both Jupyters from my computers browser using the Magic DNS, but I can’t connect two python sockets between both Jupyters using the Magic DNS.

In this example it doesn’t really matter, I could use the IPs for connecting those sockets. But for other applications I really need them to connect through their Magic DNS.

Does anyone know why this is happening? Am I doing something wrong? Or this just can’t be done with Docker for now?

Thank you very much!