Using a local domain (hostname) is a good idea if You have one. I don’t know if linux hostnames are communicated in the network and also accepted by the other machines (which are partly windows machines). It would be worth a try, but I doubt it will work out of the box.
The solution I’m using now is to generate an own certificate with openssl which is valid for the docker hosts ip and for the ip of the container in the docker network. I wouldn’t have guessed that this was possible, but I had an AI guiding me to the process . This certificate must of course be copied to caddy and activated in the Caddyfile. Browsers then will of course still complain, that the certificate is untrusted, but at least one can make an exception. And to be completely secured, one just needs to copy the certificate to the respective machines.
Another possibility the ai suggested, which I didn’t try, because it was unusable for my case, would be to set the docker network to be the same as the hosts network (setting network_mode: host
for the service in compose.yaml).
Unfortunatly I’m now currently working on another project, but I will update this post with details, as soon as I switch back.