[英]Docker communication inside docker compose and with database which is outside docker
I'm little bit confused with docker and network communication.我对 docker 和网络通信有点困惑。 I tried many things but it didn't work :-(.我尝试了很多东西,但没有用:-(。
I have following docker compose:我有以下 docker compose:
version: '3'
services:
nginx:
container_name: nginx
image: nginx:stable-alpine
restart: unless-stopped
tty: true
ports:
- 80:80
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d:ro
depends_on:
- app
networks:
- frontend
- backend
app:
restart: unless-stopped
tty: true
build:
context: .
dockerfile: Dockerfile
container_name: app
expose:
- "9090"
ports:
- 9090:9090
networks:
- backend
networks:
frontend:
backend:
And I would like to communicate:我想交流:
I cannot do this, I tried many things but something is wrong :-(我不能这样做,我尝试了很多东西,但出了点问题:-(
You can choose any of these two options:您可以选择以下两个选项中的任何一个:
# grep listen /var/lib/pgsql/data/postgresql.conf
listen_addresses = '*'
network_mode: "host"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.