From the host environment, is there a way to get the container and its properties, at least to get its IP(s) addresses, by querying using its alias?
For clarity, I'm referring to the actual alias you can give to containers on specific networks, see here
Currently my solution so far is iterating over all containers through the rest API and see if the alias matches what I'm looking for. It's obvious this is not ideal as this does not scale well in the case there are many containers on the host.
Ideally I'd want to just send a DNS request to docker's embedded dns server, but this does not seem possible. See this question/answer for more info
Does anyone know of a better solution?
/update
since an alias is tied to a network, it's expected that the to-be queried alias is accompanied with its network name, e.g., 'container-alias.network-name'. So we'd have to enumerate over the containers in a single network, but even this does not scale well if there are many containers in a single network.
Mind you, that getting all containers filtered by network name is possible in the docker api, allowing for a single REST call to the api. However, even though the 'Alias' key is in the REST result, it never holds any values. (this might be a bug, I'm not sure.) You have to GET for a specific container, i.e., GET /v1.24/containers/container-uuid/json
before you can see its aliases.