【问题标题】:Docker build :unsatisfiable constraintsDocker build :不可满足的约束
【发布时间】:2020-09-10 19:21:02
【问题描述】:

我正在尝试设置一个可以运行 CVTree 3.0 (https://github.com/ghzuo/CVTree) 的 docker 映像。 但是,我收到了这个错误:

    Sending build context to Docker daemon  206.1MB
Step 1/12 : FROM alpine AS dev
 ---> f70734b6a266
Step 2/12 : LABEL Version=0.1   MAINTAINER="Guanghong Zuo<ghzuo@fudan.edu.cn>"  description="Docker image for CVTree"
 ---> Using cache
 ---> 4c4fa0e01651
Step 3/12 : RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
 ---> Using cache
 ---> 8804b90fbc7c
Step 4/12 : RUN apk --update add --no-cache g++ make cmake zlib-dev hdf5-dev hdf5-static
 ---> Running in 8847a87b5dbd
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.11/community/x86_64/APKINDEX.tar.gz
fetch http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  hdf5-dev (missing):
    required by: world[hdf5-dev]
  hdf5-static (missing):
    required by: world[hdf5-static]
The command '/bin/sh -c apk --update add --no-cache g++ make cmake zlib-dev hdf5-dev hdf5-static' returned a non-zero code: 2

Dockerfile:

## Stage for build cvtree
FROM alpine AS dev
LABEL Version=0.1 \
  MAINTAINER="Guanghong Zuo<ghzuo@fudan.edu.cn>"\
  description="Docker image for CVTree" 

## for develop environment
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
RUN apk --update add --no-cache g++ make cmake zlib-dev hdf5-dev hdf5-static

## Build cvtree
WORKDIR /root
COPY ./src /root/cvtree/src
COPY ./CMakeLists.txt /root/cvtree/
RUN mkdir cvtree/build/ && cd cvtree/build/ && cmake .. && make 

## Stage for run cvtree 
FROM alpine AS run
COPY --from=dev /root/cvtree/build/bin/* /usr/local/bin/
RUN apk --update add --no-cache libgomp libstdc++

## for workplace
WORKDIR /root/data

我该如何解决我的问题?任何帮助将不胜感激。

【问题讨论】:

  • 问题似乎是 apk 在其可用软件包列表中找不到软件包 hdf5-Dev 和 hdf5-static ,因此无法安装它。检查 apk 包库,看看是否可以在 stable 或 edge alpine 版本中找到它。这是一个类似问题的链接,可能会有所帮助:stackoverflow.com/questions/48892448/…
  • edge alpine 版本中可以找到 hdf5-Dev 和 hdf5-static coudle 包。一周前我在使用另一台计算机时成功构建了映像。

标签: docker alpine


【解决方案1】:

可用软件包列表中缺少软件包 hdf5-Devhdf5-static,因此构建失败。

尝试使用 alpine edge 社区 docker 镜像:

## for develop environment
RUN apk --update add --no-cache g++ make cmake zlib-dev
RUN apk add hdf5-dev hdf5-static --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community

【讨论】:

  • 对不起,它不起作用。我得到了同样的错误和另一个错误:dl-cdn.alpinelinux.org/alpine/edge/community: network error (check Internet connection and firewall) WARNING: Ignoring APKINDEX.b53994b4.tar.gz: No such file or directory
  • 错误与您的网络有关network error (check Internet connection and firewall)
【解决方案2】:

我运行了以下,效果很好

RUN apk add --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/community hdf5-dev

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-11-10
    • 2018-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多