[英]Can Traefik create routes with fixed ports to containers on a Docker host?
Let's say there are two MariaDB containers running on the same host of a Docker swarm. 假设有两个MariaDB容器在Docker群的同一主机上运行。 Each container has its internal port 3306 which is dynamically exposed to eg 30004 and 30056.
每个容器具有其内部端口3306,其内部动态地暴露于例如30004和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, eg mariadb_s1:3306
(redirected to MariaDB of stack 1 on port 30004) as shown in the following picture. 我希望一个外部容器(未在堆栈中定义)通过主机名和固定端口访问一个堆栈的数据库,例如
mariadb_s1:3306
(在端口30004上重定向到堆栈1的MariaDB),如下图所示。
We also have a Traefik instance running on the Docker host. 我们也有一个运行在Docker主机上的Traefik实例。 Is Traefik capable to create these routes?
Traefik有能力创建这些路线吗?
I don't think traefik supports TCP proxying at the moment but it seems to be planned https://github.com/containous/traefik/issues/10 我不认为traefik目前不支持TCP代理,但似乎已计划在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). 但是即使有TCP代理支持,也可能难以基于主机名进行路由,因为我不认为MySQL协议包括主机名(可能是错误的)。 If so one solution could be to use TLS and route based on SNI.
如果是这样,一种解决方案可能是使用TLS并基于SNI进行路由。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.