postgres and docker-compose : can't create a custom role and database

后端 未结 1 1200
旧时难觅i
旧时难觅i 2021-02-19 11:46

I\'am trying to create a simple postgreSQL container with a custum user and database.

This is my docker-compose file :

version: \'2\'
services:
  db.po         


        
1条回答
  •  独厮守ぢ
    2021-02-19 12:07

    Modify your docker-compose.yml file as below:

    version: '2'
    services:
      db.postgres:
        container_name: db.postgres
        image: postgres:10
        environment:
          - POSTGRES_USER=myuser
          - POSTGRES_PASSWORD=myuserpassword
          - POSTGRES_DB=mydb
        ports:
          - '5432:5432'
        volumes:
          - ./pgdata:/var/lib/postgresql/data
    

    Then drop your current data entirely and re-run docker-compose up.

    0 讨论(0)
提交回复
热议问题