Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何通过在Ubuntu中静默安装Postgresql。Dockerfile?_Postgresql_Docker_Dockerfile - Fatal编程技术网

如何通过在Ubuntu中静默安装Postgresql。Dockerfile?

如何通过在Ubuntu中静默安装Postgresql。Dockerfile?,postgresql,docker,dockerfile,Postgresql,Docker,Dockerfile,我有下面的docker文件,我正在使用命令docker build-t demo:v1.构建映像 FROM ubuntu:18.04 WORKDIR /app RUN apt update \ && apt -y upgrade \ && apt install -y python3 \ && apt install -y python3-pip \ && apt install -y poppler

我有下面的docker文件,我正在使用命令
docker build-t demo:v1.
构建映像

FROM ubuntu:18.04
WORKDIR /app
RUN apt update \
    && apt -y upgrade \
    && apt install -y python3 \
    && apt install -y python3-pip \
    && apt install -y poppler-utils \
    && apt install -y libsm6 libxext6 libxrender-dev

RUN apt install -y postgresql

COPY requirements.txt /app/requirements.txt

RUN pip3 install -r requirements.txt

COPY . /app

CMD gunicorn -t 300 --workers 5 --bind  0.0.0.0:8080 wsgi
在安装postgresql时,当我使用此方法构建映像时,它需要输入并像这样停止构建过程

.
.
.
.
Setting up libpopt0:amd64 (1.16-11) ...
Setting up tzdata (2019c-0ubuntu0.18.04) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Configuring tzdata
------------------

Please select the geographic area in which you live. Subsequent configuration
questions will narrow this down by presenting a list of cities, representing
the time zones in which they are located.

  1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
  2. America     5. Arctic     8. Europe    11. SystemV
  3. Antarctica  6. Asia       9. Indian    12. US
Geographic area:

那么,如何在图像中设置postgresql,使其在不需要输入的情况下构建?此外,令人惊讶的是,即使在我输入了我的选项之后,也没有任何进一步的事情发生,并且这个过程被卡住了

将此添加到您的Dockerfile中

ARG DEBIAN_FRONTEND=noninteractive
安装
postgresql

我认为您可能希望使用
apt get
而不是
apt
来避免此警告:

警告:apt没有稳定的CLI接口。使用时要小心 脚本


谢谢,这很有效。我还将
apt
更改为
apt-get
。这是否意味着Postgres将以所有默认设置安装?是的,这是正确的,您需要在以后使用卷或DockerFile中的文件编辑配置。谢谢