![](/img/trans.png)
[英]ERROR: unsatisfiable constraints when installing PostGIS on the Alpine Docker image
[英]Cant use PostGIS on Alpine image
我正在嘗試使用Alpine
圖像來處理一些Postgres
數據庫的創建/准備。 在容器內,我正在運行以下命令:
createdb -e -O ${DB_USER} ${DB_NAME}
psql -e -d ${DB_NAME} -c "CREATE EXTENSION postgis;"
第一行工作正常,但第二行不行。
我已經用兩個 docker 構建嘗試過這個:
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
,因為該論壇中有人堅持認為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"]
我添加了最后兩個 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
?
如文檔中所述,附加擴展部分:
使用 Alpine 變體時,任何未在 postgres-contrib 中列出的 postgres 擴展都需要在您自己的映像中進行編譯(具體示例再次參見 github.com/appropriate/docker-postgis)。
對於基於這里的 debian 是 docker 圖像:
如果你想將 Postgis 與 PostgreSQL Alpine 圖像捆綁在一起,你已經構建了它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.