0

I am trying to setup a docker image that can run CVTree 3.0 (https://github.com/ghzuo/CVTree). However, I got this error:

    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

How can I sovle my problem? Any help would be deeply appreciated.

Caesar
  • 6,733
  • 4
  • 38
  • 44
  • The problem seem to be that apk cannot find packages hdf5-Dev and hdf5-static in its list of available packages and thus cannot install it. Check the apk package library and see if you can find it there in the stable or edge alpine versions. here is a link to a similar issue that may help: https://stackoverflow.com/questions/48892448/error-unsatisfiable-constraints-using-apk-in-dockerfile – camba1 May 24 '20 at 02:29
  • The packages hdf5-Dev and hdf5-static coudle be found in the edge alpine versions .And I successfully build the image when I use another computer a week ago. – JasonZhang May 24 '20 at 06:48

2 Answers2

2

The packages hdf5-Dev and hdf5-static were missing in the list of available packages and build failed because of that.

Try with alpine edge community docker image:

## 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
Vishnu Nair
  • 1,399
  • 1
  • 14
  • 21
  • Sorry, it doesn't work. I got the same error and another error:http://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 – JasonZhang May 24 '20 at 07:08
  • The error is related to your network `network error (check Internet connection and firewall)` – Vishnu Nair May 24 '20 at 14:45
0

I ran the following, and it worked fine

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