Я запускал две службы по отдельности
docker-compose run --service-ports django /bin/bash
docker-compose run --service-ports other /bin/bash
Хотя я вижу порты в docker ps
, служба не может общаться с открытыми портами в другой службе.
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
586e859afcab littlehome_other "/bin/bash" 12 minutes ago Up 12 minutes 6379-6380/tcp, 9200/tcp zibann-reservation_other_run_6
994dadb0ad7f littlehome "/bin/bash" 25 minutes ago Up 25 minutes 0.0.0.0:10011->10011/tcp zibann-reservation_django_run_3
docker-compose.yml имеет
services:
django:
restart: always
build:
context: .
dockerfile: ./compose/production/django/Dockerfile
image: littlehome
depends_on:
- other
- nginx
env_file:
- ./compose/.envs/production/postgres
# command: /app/compose/production/django/uwsgi.sh
ports:
- "0.0.0.0:10011:10011"
other:
build:
context: .
dockerfile: ./compose/production/other/Dockerfile
image: littlehome_other
# depends_on:
# - postgres
expose:
- "9200"
- "6379"
- "6380"
volumes:
- ~/.bash_history:/root/.bash_history
Я пытаюсь позволить django
поговорить с other:9200
docker network inspect zibann-reservation_default
показывает
"Containers": {
"994dadb0ad7f59e6a9ecaddfffe46aba98209ff2ae9eb0542f89dee969a85a17": {
"Name": "zibann-reservation_django_run_3",
"EndpointID": "02bf3e21aba290b999d26f0e52f2cb6b3aa792a10c86e08065d0b299995480dd",
"MacAddress": "02:42:ac:12:00:06",
"IPv4Address": "172.18.0.6/16",
"IPv6Address": ""
},
"ac5b1845f31f23bce0668ee7a427dc21aafbda0494cf67cc764df7b0898f5d23": {
"Name": "zibann-reservation_other_run_7",
"EndpointID": "b6cfcbfbf637d6521575c300d74fb483b47d6fa9e173aeb17f9c5bfc12341a37",
"MacAddress": "02:42:ac:12:00:02",
"IPv4Address": "172.18.0.2/16",
"IPv6Address": ""
},
"fe83a3addb7365b2439870e887a4eae50477f1c3531c6af60a91a07bb1226922": {
"Name": "zibann-reservation_postgres_1",
"EndpointID": "bee7d0fcc80f94303306d849fbb29a3362d1d71ceb7d34773cd82ab08bc80172",
"MacAddress": "02:42:ac:12:00:03",
"IPv4Address": "172.18.0.3/16",
"IPv6Address": ""
}
},
Служба эластичного поиска, и клиент пытается подключиться к эластичному поиску через 'http://other:9200/reviewmeta_index/_count'
Будет ли это работать?