Access to container created by docker-compose in same network
As shown in the picture, there are 4 containers. spider
is created by:
docker run xxx --net=dockernet
And the app_xx-server_1/2/3
is created by docker-compose up
from a directory named app
, docker-compose
file:
version: '3'
services:
xx-server:
image: xx-server
networks:
default:
external:
name: dockernet
And when I start the spider
and the app_xx
, I specify the same docker network explicitly(check the ip address in the picture).
Now I want to access the app_xx-server_1/2/3
from spider
by http like this:
http://app_xx-server
It does not work.
How to fix that?
Source: StackOverflow