Estou usando Docker Compose para subir meus containers no Docker, o problema que estou tendo é fazer o link entre um container e outro. Meu Docker Compose:
version: '3'
services:
DB:
image: postgres:9.6.0
ports:
- "5430:5432"
environment:
- POSTGRES_PASSWORD=postgres
- POSTGRES_USER=postgres
- POSTGRES_DB=mydatabase
volumes:
- /srv/docker/postgresql:/var/lib/postgresql
container_name: lx-gulp-db
API:
image: lx-gulp:api
ports:
- "8200:8080"
container_name: lx-gulp-api
depends_on:
- DB
links:
- "DB:lx-gulp-db"
WEB:
image: lx-gulp:web
ports:
- "8008:8080"
container_name: lx-gulp-web
links:
- "API:lx-gulp-api"
Docker-compose up DB está OK!
Docker-compose up API não funciona!
Estou usando Spring Boot para o container API e a mensagem a seguir aparece no terminal:
Connection to lx-plug-tributacao-db:5430 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Minha application.yml:
spring:
profiles: production
datasource:
url: jdbc:postgresql://lx-gulp-db:5430/mydatabase
username: postgres
password: postgres
driver-class-name: org.postgresql.Driver
test-on-borrow: true
validation-query: SELECT 1 FROM dual
jpa:
hibernate:
ddl-auto: validate
jackson:
serialization:
WRITE_DATES_AS_TIMESTAMPS: false
date-format: com.fasterxml.jackson.databind.util.ISO8601DateFormat
server:
port: 8080
flyway:
schemas: public
Aviso: estou usando Ubuntu como S.O.
O que eu estou fazendo de errado?