[英]Cant use PostGIS on Alpine image
I'm trying to use the Alpine
image to take care of some Postgres
db creation/preparation.我正在尝试使用
Alpine
图像来处理一些Postgres
数据库的创建/准备。 Inside the container, I am running the following commands:在容器内,我正在运行以下命令:
createdb -e -O ${DB_USER} ${DB_NAME}
psql -e -d ${DB_NAME} -c "CREATE EXTENSION postgis;"
The first line works fine, but the second does NOT.第一行工作正常,但第二行不行。
I have tried this with two docker builds:我已经用两个 docker 构建尝试过这个:
FROM alpine:3.6
RUN apk add -U postgresql
COPY ./db-creator.sh /db-creator.sh
CMD ["./db-creator.sh"]
This image gives me the following error:此图像给我以下错误:
CREATE EXTENSION postgis;
ERROR: could not open extension control file "/usr/share/postgresql/10/extension/postgis.control": No such file or directory
I didn't try to install PostGIS
directly as someone in this forum insisted that apk add -U postgresql
on a bare Alpine
image should suffice.我没有尝试直接安装
PostGIS
,因为该论坛中有人坚持认为apk add -U postgresql
在裸Alpine
图像上就足够了。
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"]
I added the last two RUN statements to follow what was mentioned here .我添加了最后两个 RUN 语句以遵循此处提到的内容。 In this case, I am unable to directly install
PostGIS
and get the following error:在这种情况下,我无法直接安装
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]
How on earth:)), can I use PostGIS
with the Alpine
image?究竟如何:)),我可以将
PostGIS
与Alpine
图像一起使用吗? Do I need to use other image versions or install PostGIS
differently?我是否需要使用其他图像版本或以不同方式安装
PostGIS
?
As mentioned in the documentation , Additional Extensions section:如文档中所述,附加扩展部分:
When using the Alpine variants, any postgres extension not listed in postgres-contrib will need to be compiled in your own image (again, see github.com/appropriate/docker-postgis for a concrete example).
使用 Alpine 变体时,任何未在 postgres-contrib 中列出的 postgres 扩展都需要在您自己的映像中进行编译(具体示例再次参见 github.com/appropriate/docker-postgis)。
For debian based here is the docker image:对于基于这里的 debian 是 docker 图像:
https://github.com/appropriate/docker-postgis/blob/f6d28e4a1871b1f72e1c893ff103f10b6d7cb6e1/10-2.4/Dockerfile https://github.com/appropriate/docker-postgis/blob/f6d28e4a1871b1f72e1c893ff103f10b6d7cb6e1/10-2.4/Dockerfile
If you want to bundle Postgis with PostgreSQL Alpine image you have build it.如果你想将 Postgis 与 PostgreSQL Alpine 图像捆绑在一起,你已经构建了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.