REST request from one docker container to another fails
Simply linking B to A docker run -p 8081:8081 --link AppA --name AppB image2
, then you can access the REST service using AppA:8080
.
The reason is that Docker containers run on its own subnet (normally 172.17.0.0-255) and they cannot access the network that your host is on. Also localhost
would be the container itself, not the host.