Docker Compose + Spring Boot + Postgres connection

后端 未结 3 825
耶瑟儿~
耶瑟儿~ 2021-02-12 16:40

I have a Java Spring Boot app which works with a Postgres database. I want to use Docker for both of them. I initially put just the Postgres in Docker, and I had a docker-

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-12 17:33

    You can use this.

    version: "2"
    services:
        sample_db-postgresql:
            image: postgres:9.5
            ports:
                - 5432:5432
            environment:
                - POSTGRES_PASSWORD=sample
                - POSTGRES_USER=sample
                - POSTGRES_DB=sample
             volumes:
                - sample_db:/var/lib/postgresql/data
    
    volumes:
        sample_db:
    

提交回复
热议问题