worstcase / blockade

Docker-based utility for testing network failures and partitions in distributed applications

Home Page:http://blockade.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ports are not exposed

simonbahuchet opened this issue · comments

Hello,
First thank you for blockade!
I noticed something about the ports. I might use the wrong configuration but I think the ports are not exposed properly:

containers:
  node1:
    image: sisays/elasticsearch-docker
    command: /elasticsearch/bin/elasticsearch -Des.config=/data/config/elasticsearch.yml
    volumes:
      "/vagrant/experiments/es-cluster/split-brain/run/node1": "/data"
    ports:
      9200: 9200
      9300: 9300

  node2:
    image: sisays/elasticsearch-docker
    command: /elasticsearch/bin/elasticsearch -Des.config=/data/config/elasticsearch.yml
    volumes:
      "/vagrant/experiments/es-cluster/split-brain/run/node2": "/data"
    ports:
      9202: 9200
      9302: 9300
    links:
      node1: node1

  node3:
    image: sisays/elasticsearch-docker
    command: /elasticsearch/bin/elasticsearch -Des.config=/data/config/elasticsearch.yml
    volumes:
      "/vagrant/experiments/es-cluster/split-brain/run/node3": "/data"
    ports:
      9202: 9300
      9302: 9300
    links:
      node1: node1
      node2: node2

I start the cluster:

$ blockade up
NODE            CONTAINER ID    STATUS  IP              NETWORK    PARTITION
node1           c955548045fe    UP      172.17.0.17     NORMAL
node2           c617e523e595    UP      172.17.0.18     NORMAL
node3           6a9ec26d2639    UP      172.17.0.19     NORMAL

but then, when I want to check the exposed ports:

$ docker port c955548045fe

I get nothing. And as a consequence, I cannot access the service from the host

When I do pretty much the same with fig, I do get the ports:

$ docker ps
CONTAINER ID        IMAGE                               COMMAND                CREATED             STATUS              PORTS                                            NAMES
1a772e415b68        sisays/elasticsearch-docker:1.4.0   "/elasticsearch/bin/   49 seconds ago      Up 47 seconds       0.0.0.0:9202->9200/tcp, 0.0.0.0:9302->9300/tcp   splitbrain_node3_1
ae0d67bdc8c7        sisays/elasticsearch-docker:1.4.0   "/elasticsearch/bin/   49 seconds ago      Up 48 seconds       0.0.0.0:9201->9200/tcp, 0.0.0.0:9301->9300/tcp   splitbrain_node2_1
bef16973c695        sisays/elasticsearch-docker:1.4.0   "/elasticsearch/bin/   50 seconds ago      Up 49 seconds       0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   splitbrain_node1_1
$ docker port bef16973c695
9200/tcp -> 0.0.0.0:9200
9300/tcp -> 0.0.0.0:9300

Thanks for the nice bug report. I'll check it out soon and see if I can reproduce the issue.

Can I send a PR to share an exemple + change (rename existing 'ports' into 'expose' and use 'ports' to publish the ports) ?