Replies: 4 comments 9 replies
-
You could use the internal Docker DNS server to resolve container names if you use docker networks. Or did I miss the point? 😅 |
Beta Was this translation helpful? Give feedback.
-
Can it work if containers are assigned to different docker networks (e. g. by using the docker-compose)? |
Beta Was this translation helpful? Give feedback.
-
So, I was looking into implementing this into its own resolver (similar to the host file resolver) since the configuration "effort" one has to do to get this up and running was quite a lot and requires changes in one's Docker setup (no offense @kwitsch, I appreceate the detailed example you gave). Initially I thought I could implement this purely by connecting to the socket and reading the returned json, but I decided against it and used the official docker SDK for Go instead. There are other dependencies in blocky, that are probably not used by many (database connections for example) so I thought adding another lib shouldn't hurt that much and it makes development when it comes to error handling and maintenance easier. I implemented basic functionality in my fork. It's still missing further error handling, documentation and probably some QOL enhancements because people's setups are different and only using the container's name is probably not everyone's preference - especially when it comes to container names in a docker-compose setup. Before I continue to work on tests and documentation I'd like to know if this is something you're (@0xERR0R) interested in merging into the project or if this is too niche. My changes so far: development...sn0opy:blocky:feature/docker_resolver |
Beta Was this translation helpful? Give feedback.
-
I think, I got the idea from your docker resolver implementation. But I think, you want to resolve the clientName (with client name resolver), do you use blocky itself as client resolver? Regarding the implementation: it is a good idea to use the library and not to parse the JSON. It would also make sense to use docker event listener to be notified if a new container was started etc., in this case the periodical reload is not necessary. |
Beta Was this translation helpful? Give feedback.
-
I am running several containers on the same host blocky is running on. DNS lookups for these containers are logged by blocky, but unfortunately they appear with their docker-internal ip.
There are projects like dvddarias/docker-hoster which adds containers with specific parameters to a mounted hostfile. Since blocky already has a hostfile lookup, this would be a valid solution.
I was wondering if there's an oversight on my end to provide proper names in my logs/stats for containers, or if this is even a feature that could be added to blocky. This change would not introduce any new dependencies since blocky could read the information directly from the docker socket via standard libs.
Beta Was this translation helpful? Give feedback.
All reactions