PostgreSQL
 sql >> Database >  >> RDS >> PostgreSQL

Impossibile connettersi al database Postgres dal contenitore Golang Docker

Prova a condividere una rete

version: "3.8"
services:
    postgres:
        image: postgres:alpine
        environment:
        - POSTGRES_DB=postgres
        - POSTGRES_USER=postgres
        - POSTGRES_PASSWORD=postgres
        ports:
        - 5432:5432
        restart: always
        networks: [ "go_develop" ]

    server:
        build: .
        depends_on:
        - postgres
        ports:
        - "2302:2302"
        - "80:80"
        restart: always
        networks: [ "go_develop" ]

networks:
    go_develop:
        driver: bridge