我正在嘗試使用docker創建簡單的postgres服務器。我使用官方postgres image作爲我的容器的基礎。 我Dockerfile包含以下命令:Docker上的Postgres。我如何創建一個數據庫和一個用戶?
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"?
我做錯了嗎?
您是否檢查過「*服務器是否在本地運行並接受Unix域套接字*上的連接」? – 2014-10-05 09:47:44