mardi 4 juin 2019

running toxiproxy inside a container and accessing to service from host machine

I want to use toxiproxy to put extra latency into one service. The problem I have is I cannot access the service from the host machine even if I add necessary port forwarding.

here is the docker compose configuration:

 product-service:
    image: my-image
    ports:
      - "8014: 8014"
  toxiproxy:
    image: shopify/toxiproxy
    links:
      - product-service
    ports:
      - "8474:8474"
      - "8379:8014"

here is the config of toxiproxy:

{
    "product-service": {
        "name": "product-service",
        "listen": "[::]:8379",
        "upstream": "product-service:8014",
        "enabled": true,
        "toxics": []
    }
}

On the container of toxiproxy, I can access the product service via the proxy, with the command like curl localhost:8379. What do I miss here so that I cannot access on my host machine with the same command?

Aucun commentaire:

Enregistrer un commentaire