Docker - How can run the psql command in the postgres container?

前端 未结 6 1330
孤独总比滥情好
孤独总比滥情好 2020-12-22 18:44

I would like to use the psql in the postgres image in order to run some queries on the database. But unfortunately when I attach to the postgres container, I got that error

6条回答
  •  独厮守ぢ
    2020-12-22 19:32

    RUN /etc/init.d/postgresql start &&\
        psql --command "CREATE USER docker WITH SUPERUSER PASSWORD 'docker';" &&\
        createdb -O docker docker &&\
    

提交回复
热议问题