错误:在Alpine Docker映像上安装PostGIS时的约束无法满足

编程入门 行业动态 更新时间:2024-10-23 21:26:51
本文介绍了错误:在Alpine Docker映像上安装PostGIS时的约束无法满足的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

好,所以任务似乎很简单!使用Alpine图像(因为它重量轻且安全)来执行某些PostgreSQL DB创建/迁移.我正在使用以下Dockerfile,其代码为这里:

Ok, so the task seems pretty easy! Use an Alpine image (as it is light-weight and secure) to perform some PostgreSQL DB creation/migrations. I'm using the following Dockerfile using the code here:

FROM alpine:latest RUN apk add -U postgresql # install PostGIS ENV POSTGIS_VERSION 2.5.2 ENV POSTGIS_SHA256 225aeaece00a1a6a9af15526af81bef2af27f4c198de820af1367a792ee1d1a9 RUN set -ex \ \ && apk add --no-cache --virtual .fetch-deps \ ca-certificates \ openssl \ tar \ \ && wget -O postgis.tar.gz "github/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \ && echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \ && mkdir -p /usr/src/postgis \ && tar \ --extract \ --file postgis.tar.gz \ --directory /usr/src/postgis \ --strip-components 1 \ && rm postgis.tar.gz \ \ && apk add --no-cache --virtual .build-deps \ autoconf \ automake \ g++ \ json-c-dev \ libtool \ libxml2-dev \ make \ perl \ \ && apk add --no-cache --virtual .build-deps-edge \ --repository dl-cdn.alpinelinux/alpine/edge/testing \ --repository dl-cdn.alpinelinux/alpine/edge/main \ gdal-dev \ geos-dev \ proj4-dev \ protobuf-c-dev \ && cd /usr/src/postgis \ && ./autogen.sh \ # configure options taken from: # anonscm.debian/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie && ./configure \ # --with-gui \ && make \ && make install \ && apk add --no-cache --virtual .postgis-rundeps \ json-c \ && apk add --no-cache --virtual .postgis-rundeps-edge \ --repository dl-cdn.alpinelinux/alpine/edge/testing \ --repository dl-cdn.alpinelinux/alpine/edge/main \ geos \ gdal \ proj4 \ protobuf-c \ && cd / \ && rm -rf /usr/src/postgis \ && apk del .fetch-deps .build-deps .build-deps-edge COPY ./db-creator.sh /db-creator.sh CMD ["./db-creator.sh"]

但是,由于某些unsatisfiable constraints错误,没有使用apk安装依赖项.错误如下,完整日志可在此问题中找到.

However, the dependencies are not installed using apk due to some unsatisfiable constraints error. The error is as follows and the full logs are available in this issue I opened.

ERROR: unsatisfiable constraints: gdal-dev (missing): required by: .build-deps-edge-20200123.143501[gdal-dev] geos-dev (missing): required by: .build-deps-edge-20200123.143501[geos-dev] proj4-dev (missing): required by: .build-deps-edge-20200123.143501[proj4-dev]

感谢您的帮助.

推荐答案

github上的代码包含另一个图像 postgres:11-alpine 与所讨论的图像alpine:latest相比.

The code on github contains another image postgres:11-alpine comparing to image defined in question: alpine:latest.

软件包 gdal-dev , geos-dev , protobuf-c-dev 不在边缘回购测试分支中,它们是迁移到稳定的v3.11存储库.此外,proj4-dev重命名为 proj-dev ,该文件也位于稳定的v3.11存储库中.

Packages gdal-dev, geos-dev, protobuf-c-dev are no longer in edge repo testing branch, they were migrated to stable v3.11 repository. Also proj4-dev was renamed to proj-dev, which is also in stable v3.11 repository.

所以要修复Dockerfile,我们只需要从v3.11 repo安装上述软件包,即更改这部分代码:

So to fix the Dockerfile we just need to install above packages from v3.11 repo, ie change this part of code:

&& apk add --no-cache --virtual .build-deps \ autoconf \ automake \ g++ \ json-c-dev \ libtool \ libxml2-dev \ make \ perl \ \ && apk add --no-cache --virtual .build-deps-edge \ --repository dl-cdn.alpinelinux/alpine/edge/testing \ --repository dl-cdn.alpinelinux/alpine/edge/main \ gdal-dev \ geos-dev \ proj4-dev \ protobuf-c-dev \ proj4-dev \ protobuf-c-dev \

对此:

&& apk add --no-cache --virtual .build-deps \ autoconf \ automake \ g++ \ gdal-dev \ geos-dev \ json-c-dev \ libtool \ libxml2-dev \ make \ perl \ proj-dev \ protobuf-c-dev \ \

最后的Dockerfile是:

FROM alpine:3.11 RUN apk add -U postgresql # install PostGIS ENV POSTGIS_VERSION 2.5.2 ENV POSTGIS_SHA256 225aeaece00a1a6a9af15526af81bef2af27f4c198de820af1367a792ee1d1a9 RUN set -ex \ \ && apk add --no-cache --virtual .fetch-deps \ ca-certificates \ openssl \ tar \ \ && wget -O postgis.tar.gz "github/postgis/postgis/archive/$POSTGIS_VERSION.tar.gz" \ && echo "$POSTGIS_SHA256 *postgis.tar.gz" | sha256sum -c - \ && mkdir -p /usr/src/postgis \ && tar \ --extract \ --file postgis.tar.gz \ --directory /usr/src/postgis \ --strip-components 1 \ && rm postgis.tar.gz \ \ && apk add --no-cache --virtual .build-deps \ autoconf \ automake \ g++ \ gdal-dev \ geos-dev \ json-c-dev \ libtool \ libxml2-dev \ make \ perl \ proj-dev \ protobuf-c-dev \ \ && cd /usr/src/postgis \ && ./autogen.sh \ # configure options taken from: # anonscm.debian/cgit/pkg-grass/postgis.git/tree/debian/rules?h=jessie && ./configure \ # --with-gui \ && make \ && make install \ && apk add --no-cache --virtual .postgis-rundeps \ json-c \ && apk add --no-cache --virtual .postgis-rundeps-edge \ --repository dl-cdn.alpinelinux/alpine/edge/testing \ --repository dl-cdn.alpinelinux/alpine/edge/main \ geos \ gdal \ proj4 \ protobuf-c \ && cd / \ && rm -rf /usr/src/postgis \ && apk del .fetch-deps .build-deps .build-deps-edge COPY ./db-creator.sh /db-creator.sh CMD ["./db-creator.sh"]

更多推荐

错误:在Alpine Docker映像上安装PostGIS时的约束无法满足

本文发布于:2023-10-13 09:52:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1487621.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:映像   错误   Docker   Alpine   PostGIS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!