我试图使用Alpine映像来处理一些Postgres db的创建/准备工作。在容器中,我运行以下命令:
createdb -e -O ${DB_USER} ${DB_NAME}
psql -e -d ${DB_NAME} -c "CREATE EXTENSION postgis;"第一行工作正常,但第二行不行。
我试过用两个修船机构建:
FROM alpine:3.6
RUN apk add -U postgresql
COPY ./db-creator.sh /db-creator.sh
CMD ["./db-creator.sh"]此图像给出了以下错误:
CREATE EXTENSION postgis;
ERROR: could not open extension control file "/usr/share/postgresql/10/extension/postgis.control": No such file or directory我并没有试图直接安装PostGIS,因为这个论坛中的某个人坚持认为,光Alpine映像上的apk add -U postgresql就足够了。
FROM postgres:9.6.4-alpine
RUN apk add -U postgresql
RUN echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk update && apk add -u postgis
COPY ./db-creator.sh /db-creator.sh
CMD ["./db-creator.sh"]我添加了最后两个RUN语句来跟随提到的这里。在这种情况下,我无法直接安装PostGIS并获得以下错误:
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.6/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
WARNING: This apk-tools is OLD! Some packages might not function properly.
v3.6.5-44-gda55e27396 [http://dl-cdn.alpinelinux.org/alpine/v3.6/main]
v3.6.5-34-gf0ba0b43d5 [http://dl-cdn.alpinelinux.org/alpine/v3.6/community]
v20200117-229-g073aaff70d [http://dl-cdn.alpinelinux.org/alpine/edge/testing]
OK: 12520 distinct packages available
WARNING: This apk-tools is OLD! Some packages might not function properly.
postgis (missing):
ERROR: unsatisfiable constraints:
required by: world[postgis]),我可以在PostGIS映像中使用Alpine吗?是否需要使用其他映像版本或以不同方式安装PostGIS?
发布于 2020-01-22 14:55:09
正如文档中提到的,附加扩展部分:
当使用阿尔卑斯变体时,postgres中没有列出的任何postgres扩展都需要按照您自己的映像进行编译(具体示例请参见github.com/ listed /docker-postgis)。
对于debian,这里是码头映像:
如果您想将Postgis与PostgreSQL高寒映像捆绑在一起,那么您已经构建了它。
https://stackoverflow.com/questions/59862229
复制相似问题