我想构建一个docker-image,其中有一个用postgresql恢复的数据库。
我试图用postgres作为基础图像来构建图像,然后运行必要的命令。这是我的Dockerfile
:
FROM postgres
RUN apt-get update
RUN apt-get install -y wget
RUN mkdir /ModelPolisher/
RUN cd /ModelPolisher/
RUN wget --header 'Host: ucc49fcb8218043080f037d0442d.dl.dropboxusercontent.com' --user-agent 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' --header 'Accept-Language: en-US,en;q=0.5' --referer 'https://www.dropbox.com/' --header 'Upgrade-Insecure-Requests: 1' 'https://ucc49fcb8218043080f037d0442d.dl.dropboxusercontent.com/cd/0/get/AkLV1g-8g6w53dPuJfbcvpso-ZJrIWuPHfBXMCY6CZtqOODbQsCKk7F7fVMIV-QWgLA8CqN7rie59VOFitRD7pBvy0sK4eoe6FaYel5WchR15Q/file?_download_id=57196784975938634105643581937043576254672194718625869681975173686&_notify_domain=www.dropbox.com&dl=1' --output-document 'database.dump'
#Restore database
RUN su postgres
RUN createuser -s zaking && createdb bigg && pg_restore -c -d bigg /ModelPolisher/database.dump
RUN exit
#clear temporary files
RUN rm database.dump
CMD [“echo”,”Image created”]
出现以下错误:
createuser: could not connect to database postgres: 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"?
有人可以告诉我Dockerfile中缺少什么吗?