Reputation: 12876
Let's say there are two MariaDB containers running on the same host of a Docker swarm. Each container has its internal port 3306 which is dynamically exposed to e.g. 30004 and 30056.
I'd like an external container (not defined in the stack) to access the database of one stack by a hostname and fixed port, e.g. mariadb_s1:3306
(redirected to MariaDB of stack 1 on port 30004) as shown in the following picture.
We also have a Traefik instance running on the Docker host. Is Traefik capable to create these routes?
Upvotes: 1
Views: 294
Reputation: 11425
I don't think traefik supports TCP proxying at the moment but it seems to be planned https://github.com/containous/traefik/issues/10
But even with TCP proxy support it might be hard to route based on hostname as I don't think the MySQL protocol includes the hostname (might be wrong). If so one solution could be to use TLS and route based on SNI.
Upvotes: 2