i have 2 containers running: c1 , c2.
c1 listening on port 2181 , c2 connecting port 2181
problem c2 fails connect c1 on said port , i'm not sure why.
when run code connects c1 not in container works fine. know c1 running , port exposed correctly. when drop application in it's own container port not visible anymore.
i've tried lsof within c2 , not listed, makes sense why fails.
any clues on need next appreciated.
i using docker-compose containers should in same network group default:
here's compose file:
version: '2' services: c1: build: . volumes: - .:/code depends_on: - c2 c2: image: jplock/zookeeper ports: - "2181:2181" - "2888:2888" - "3888:3888"
in c1, initiator using uri localhost:2181
if come across post might help.
using docker-compose, containers set hostname matching service alias in docker compose file, see docs here:
https://docs.docker.com/compose/networking/
modified quote fit use-case
each container can hostname (i.e c2) , appropriate container’s ip address. example, c1 application code connect url //c2:2181.
Comments
Post a Comment