REST request from one docker container to another fails -
i have 2 applications, 1 of has restful interface used other. both running on same machine.
application runs in docker container. running using command line:
docker run -p 40000:8080 --name appa image1
when test application b outside docker container (in other words, before dockerized) application b executes restful requests , receives responses without problems.
unfortunately, when dockerize , run application b within container:
docker run -p 8081:8081 --name appb image2
whenever attempt send restful request application a, following:
connect localhost:40000 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: connection refused
of course, tried making application b connect using machine's ip address. when that, following failure:
connect 192.168.1.101:40000 failed: no route host
has seen kind of behavior before? causes application communicates dockerized application outside docker container fail communicate same dockerized application once dockerized???
someone please advise...
simply linking b docker run -p 8081:8081 --link appa --name appb image2
, can access rest service using appa:8080
.
the reason docker containers run on own subnet (normally 172.17.0.0-255) , cannot access network host on. localhost
container itself, not host.
Comments
Post a Comment