I use Docker-Compose.
Some time ago i used this code. Nginx used ip and port from environment variables like this "API_PORT_5432_TCP_ADDR" "API_PORT_5432_TCP_PORT".
Now i can not to connect from one container to other. I found some description in the documentation, that "links" should do such work, i mean it creates environment variables and later i can get it in other container. But i do not know, what i do wrong. Are there ways to resolve that problem? Will be glad if you give me links or some code lines.
Thank you.
version: '3.0'
services:
ubuntubase:
build: ./ubuntu-base
backend:
build: ./backend
links:
- postgresql:db
expose:
- "6060"
depends_on:
- ubuntubase
- postgresql
nginxreverseproxy:
build: ./nginx-reverse-proxy
expose:
- "80"
- "443"
links:
- backend:api
ports:
- "80:80"
volumes:
- ./logs/:/var/log/nginx/
depends_on:
- ubuntubase
- backend
postgresql:
restart: always
image: sameersbn/postgresql:9.6-2
expose:
- "5432"
depends_on:
- ubuntubase
environment:
- DEBUG=false
- DB_USER=...
- DB_PASS=...
- DB_NAME=...
volumes:
- /srv/docker/postgresql:/var/lib/postgresql