postgresql – Docker上的Postgres.如何创建数据库和用户?
我正在尝试使用docker创建简单的postgres服务器.我使用官方postgres image作为我的容器的基础.我的Dockerfile包含以下命令:
FROM postgres
USER postgres
RUN /etc/init.d/postgresql start &&\
psql --command "CREATE USER user WITH SUPERUSER PASSWORD 'user';" &&\
createdb -O user app
当我尝试运行它时,我有一个错误:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket “/var/run/postgresql/.s.PGSQL.5432”?
我做错了什么?