链接有时不适用于Docker-compose版本2

时间:2016-04-02 16:17:21

标签: docker-compose

考虑以下(工作)docker-compose.yaml文件:

nsqlookupd:
  image: nsqio/nsq
  ports:
    - "4160:4160"
    - "4161:4161"
  command: /nsqlookupd

nsqd:
  image: nsqio/nsq
  ports:
    - "4150"
    - "4151"
  links:
    - nsqlookupd:nsqlookupd
  command: /nsqd --lookupd-tcp-address=nsqlookupd:4160

nsqadmin:
  image: nsqio/nsq
  ports:
    - "4171:4171"
  links:
    - nsqlookupd:nsqlookupd
  command: /nsqadmin --lookupd-http-address=nsqlookupd:4161

如果我将格式更新为版本" 2" (只添加2个第一行):

version: "2"
services:
  nsqlookupd:
    image: nsqio/nsq
    ports:
      - "4160:4160"
      - "4161:4161"
    command: /nsqlookupd

  nsqd:
    image: nsqio/nsq
    ports:
      - "4150"
      - "4151"
    links:
      - nsqlookupd:nsqlookupd
    command: /nsqd --lookupd-tcp-address=nsqlookupd:4160

  nsqadmin:
    image: nsqio/nsq
    ports:
      - "4171:4171"
    links:
      - nsqlookupd:nsqlookupd
    command: /nsqadmin --lookupd-http-address=nsqlookupd:4161

它不再起作用,我不明白为什么。 如果不工作,我的意思是服务无法创建tcp连接:

nsqd_1       | [nsqd] 2016/04/02 16:10:47.511813 LOOKUPD(nsqlookupd:4160): ERROR PING - dial tcp: i/o timeout

nsqadmin_1   | [nsqadmin] 2016/04/02 16:10:51.865724 ERROR: failed to get topics - Failed to query any nsqlookupd: Get http://nsqlookupd:4161/topics: dial tcp: i/o timeout

从链接的容器中,我可以ping其他服务(即:从nsqadmin,我可以ping nsqlookupd

有什么想法吗?

0 个答案:

没有答案