简体   繁体   English

libgit2 alpine linux docker错误

[英]libgit2 alpine linux docker error

Ok, This is above my understanding. 好的,这超出了我的理解。 I have really no idea what exactly is wrong here but something is. 我真的不知道这里究竟出了什么问题,但有些事情是。 I am on the verge of breaking by banging my head on the wall and yet nothing came up. 我濒临破墙,但是没有任何事情发生。 Can any kind soul please help me. 任何善良的灵魂都可以帮助我。

This is my Dockerfile - 这是我的Dockerfile -

FROM golang:1.7-alpine
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN apk update && apk upgrade && apk add --no-cache bash git openssh alpine-sdk libgit2

RUN pkg-config --print-errors --exists libgit2

I have wrote it with advice from here - How do I install libgit2 on Alipne linux 我在这里写了一些建议 - 如何在Alipne linux上安装libgit2

And this is the end result - 这是最终结果 -

Sending build context to Docker daemon   513 kB
Step 1 : FROM golang:1.7-alpine
 ---> 161e259af05d
Step 2 : RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
 ---> Running in 428c62a1fc94
 ---> 80a4e0dca9d7
Removing intermediate container 428c62a1fc94
Step 3 : RUN apk update && apk upgrade && apk add --no-cache bash git openssh alpine-sdk libgit2
 ---> Running in 7876608fa4e7
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
v3.4.4-9-g07aa589 [http://dl-cdn.alpinelinux.org/alpine/v3.4/main]
v3.4.4-1-g77d84e1 [http://dl-cdn.alpinelinux.org/alpine/v3.4/community]
v3.4.0-4072-g7fdcbdd [http://dl-4.alpinelinux.org/alpine/edge/testing]
OK: 7381 distinct packages available
(1/2) Upgrading libcrypto1.0 (1.0.2i-r0 -> 1.0.2j-r0)
(2/2) Upgrading libssl1.0 (1.0.2i-r0 -> 1.0.2j-r0)
Executing busybox-1.24.2-r11.trigger
OK: 5 MiB in 12 packages
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-4.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
(1/63) Installing fakeroot (1.20.2-r3)
(2/63) Installing sudo (1.8.16-r0)
(3/63) Installing libcap (2.25-r0)
(4/63) Installing pax-utils (1.1.6-r0)
(5/63) Installing openssl (1.0.2j-r0)
(6/63) Installing libattr (2.4.47-r4)
(7/63) Installing attr (2.4.47-r4)
(8/63) Installing tar (1.29-r0)
(9/63) Installing pkgconf (0.9.12-r0)
(10/63) Installing patch (2.7.5-r1)
(11/63) Installing libssh2 (1.7.0-r0)
(12/63) Installing libcurl (7.50.3-r0)
(13/63) Installing curl (7.50.3-r0)
(14/63) Installing abuild (2.27.1-r1)
Executing abuild-2.27.1-r1.pre-install
(15/63) Installing binutils-libs (2.26-r0)
(16/63) Installing binutils (2.26-r0)
(17/63) Installing gmp (6.1.0-r0)
(18/63) Installing isl (0.14.1-r0)
(19/63) Installing libgomp (5.3.0-r0)
(20/63) Installing libatomic (5.3.0-r0)
(21/63) Installing libgcc (5.3.0-r0)
(22/63) Installing pkgconfig (0.25-r1)
(23/63) Installing mpfr3 (3.1.2-r0)
(24/63) Installing mpc1 (1.0.3-r0)
(25/63) Installing libstdc++ (5.3.0-r0)
(26/63) Installing gcc (5.3.0-r0)
(27/63) Installing make (4.1-r1)
(28/63) Installing musl-dev (1.1.14-r12)
(29/63) Installing libc-dev (0.7-r0)
(30/63) Installing fortify-headers (0.8-r0)
(31/63) Installing g++ (5.3.0-r0)
(32/63) Installing build-base (0.4-r1)
(33/63) Installing expat (2.1.1-r1)
(34/63) Installing pcre (8.38-r1)
(35/63) Installing git (2.8.3-r0)
(36/63) Installing xz-libs (5.2.2-r1)
(37/63) Installing lzo (2.09-r1)
(38/63) Installing squashfs-tools (4.3-r2)
(39/63) Installing libmagic (5.27-r0)
(40/63) Installing file (5.27-r0)
(41/63) Installing bzip2 (1.0.6-r5)
(42/63) Installing libbz2 (1.0.6-r5)
(43/63) Installing cdrkit (1.1.11-r2)
(44/63) Installing acct (6.6.2-r0)
(45/63) Installing lddtree (1.25-r2)
(46/63) Installing libuuid (2.28-r3)
(47/63) Installing libblkid (2.28-r3)
(48/63) Installing device-mapper (2.02.154-r0)
(49/63) Installing cryptsetup-libs (1.7.1-r0)
(50/63) Installing kmod (22-r0)
(51/63) Installing mkinitfs (3.0.5-r1)
Executing mkinitfs-3.0.5-r1.post-install
(52/63) Installing mtools (4.0.18-r1)
(53/63) Installing alpine-sdk (0.4-r3)
(54/63) Installing ncurses-terminfo-base (6.0-r7)
(55/63) Installing ncurses-terminfo (6.0-r7)
(56/63) Installing ncurses-libs (6.0-r7)
(57/63) Installing readline (6.3.008-r4)
(58/63) Installing bash (4.3.42-r3)
Executing bash-4.3.42-r3.post-install
(59/63) Installing libgit2-libs (0.24.1-r0)
(60/63) Installing libgit2 (0.24.1-r0)
(61/63) Installing openssh-client (7.2_p2-r3)
(62/63) Installing openssh-sftp-server (7.2_p2-r3)
(63/63) Installing openssh (7.2_p2-r3)
Executing busybox-1.24.2-r11.trigger
Executing ca-certificates-20160104-r4.trigger
OK: 198 MiB in 75 packages
 ---> f73132c8c72e
Removing intermediate container 7876608fa4e7
Step 4 : RUN pkg-config --print-errors --exists libgit2
 ---> Running in f69f97142e81
Package libgit2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libgit2.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libgit2', required by 'world', not found
The command '/bin/sh -c pkg-config --print-errors --exists libgit2' returned a non-zero code: 1

So what is it that is wrong? 那有什么不对呢? Why it can not see the installed libgit2 (0.24.1-r0). 为什么它看不到安装的libgit2(0.24.1-r0)。 I really tried every possible way to get this one package built and installed in my docker container and I can not simply do it. 我真的尝试了一切可能的方法来构建和安装在我的docker容器中的这个包,我不能简单地做到这一点。 I have no idea what is wrong. 我不知道出了什么问题。 Please help me. 请帮我。

-------------- EDIT --------------编辑

The last command in my Dockerfile is actually taken from here http://lists.subsurface-divelog.org/pipermail/subsurface/2014-November/015646.html 我的Dockerfile中的最后一个命令实际上是从这里获取的http://lists.subsurface-divelog.org/pipermail/subsurface/2014-November/015646.html

And certainly the issue depicted there and the one that I have is not the same 当然,那里描述的问题和我所拥有的问题并不相同

---------------- EDIT 2 ----------------编辑2

Anyone interested in doing the effort all by your self can follow this - 任何有兴趣全力以赴的人都可以遵循这个 -

FROM golang:1.7-alpine
ENV TARGET venv
RUN echo http://dl-4.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN apk update && apk upgrade && apk add --no-cache bash git openssh alpine-sdk libcurl
RUN apk update && apk add cmake
RUN git clone git://github.com/libgit2/libgit2.git
WORKDIR $GOPATH/libgit2
RUN git checkout v0.24.0 && rm -rf build && mkdir build && cd build \
    && cmake .. -DCMAKE_INSTALL_PREFIX=$TARGET -DBUILD_CLAR=OFF && cmake --build . --target install
ENV PKG_CONFIG_PATH /go/libgit2/build/venv/lib/pkgconfig:$PKG_CONFIG_PATH

For a simpler and cleaner approach follow the accepted answer. 对于更简单和更清洁的方法,请遵循接受的答案。 This one only has the advantage of having libgit2 version which is not available via apk yet. 这个只有libgit2版本的优势,但尚未通过apk获得。

One more thing - -DBUILD_CLAR=OFF is there because I did not want to install Python in the image just to run the tests 还有一件事 - -DBUILD_CLAR=OFF是因为我不想在图像中安装Python只是为了运行测试

You are trying to compile a package using libgit2 , so you need the libgit2-dev development package with the headers, pc file, etc. 您正在尝试使用libgit2编译包,因此您需要libgit2-dev开发包以及头文件,pc文件等。

This docker file file builds git2go successfully: 这个docker文件文件成功构建了git2go:

FROM golang:1.7-alpine
RUN apk update && apk upgrade && apk add --no-cache bash git openssh alpine-sdk libgit2-dev
RUN go get -v github.com/libgit2/git2go

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM