I may be showing my lack of knowledge with this question, but can you use Docker Custom Network Container names in URLs within a Gateway? Example would be using the Container Name in a URL for MQTT Transmission.
My experiments so far indicate that only the static IP address can be used to another container and not the Custom Network name even though within the containers Bash session the Custom Network name does resolve with a 'ping' command using the name (i.e. Container resolves name, but Gateway does not).
You definitely can do this. Keep in mind that the default bridge network on a standard Docker Engine installation does NOT provide DNS records for other attached containers. But on other custom networks you'll be able to resolve by container name (or in the case of Docker Compose, "service" name).
I realize that I showed an example with a ping command, but it can also be used in other places where a hostname can be supplied, such as in the URL for MQTT Engine/Transmission, e.g.:
Thanks Kevin for the response. I see your example, but when I try to use this with a Custom Network it oddly does not resolve in the MQTT URL all though it does resolve in the container's BASH session (see: GIF)
Snippet of Docker-compose that creates the custom network:
networks:
iX_Sandbox:
driver: bridge
ipam:
config:
- subnet: 192.168.1.0/24
ME-d681d05b-f2fb-4dca: Error while attempting connect (with autoReconnect=false) to tcp://ignition_1:1883: Unable to make field private transient java.lang.String java.net.URI.userInfo accessible: module java.base does not "opens java.net" to unnamed module @299ee532
Following this...
# Disconnect `ignition_1` container from `testing` bridge network
docker network disconnect testing ignition_1
# Reconnect `ignition_1` container to `testing` network with alias `ignition-1`
docker network connect --alias ignition-1 testing ignition_1
... and adjusting the URL to use ignition-1 got me a valid connection: