通过HTTP for API Gateway在链接的Docker容器之间进行通信

I'm currently working on a golang web app which is currently one application consisting of numerous packages and is deployed in an individual docker container. I have a redis instance and a mysql instance deployed and linked as separate containers. In order to get their addresses, I pull them from the environment variables set by docker. I would like to implement an api gateway pattern wherein I have one service which exposes the HTTP port (either 80 for http or 443 for https) called 'api' which proxies requests to other services. The other services ideally do not expose any ports publicly but rather are linked directly with the services they depend on.

So, api will be linked with all the services except for mysql and redis. Any service that need to validate a user's session information will be linked with the user service, etc. My question is, how can I make my http servers listen to http requests on the ports that docker links between my containers.

查看全部
dtmsaqtly798322992
dtmsaqtly798322992
2016/10/18 07:50
  • docker
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复