Alpine包安装协议错误

时间:2017-12-02 16:59:46

标签: docker alpine

我正在尝试在alpine 3.6上安装git。它在第一个实例中失败了Protocol error但是在第二个实例上工作。特定pcrelibcurl未在第一个实例中安装。这是我想要做的日志。

$ docker run -it alpine:3.6 /bin/sh
/ # apk --update add git
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
(1/6) Installing ca-certificates (20161130-r2)
(2/6) Installing libssh2 (1.8.0-r1)
(3/6) Installing libcurl (7.56.1-r0)
ERROR: libcurl-7.56.1-r0: Protocol error
(4/6) Installing expat (2.2.0-r1)
(5/6) Installing pcre (8.41-r0)
ERROR: pcre-8.41-r0: Protocol error
(6/6) Installing git (2.13.5-r0)
Executing busybox-1.26.2-r9.trigger
Executing ca-certificates-20161130-r2.trigger
2 errors; 24 MiB in 15 packages
/ # git
Error loading shared library libpcre.so.1: No such file or directory (needed by /usr/bin/git)
Error relocating /usr/bin/git: pcre_compile: symbol not found
Error relocating /usr/bin/git: pcre_exec: symbol not found
Error relocating /usr/bin/git: pcre_maketables: symbol not found
Error relocating /usr/bin/git: pcre_study: symbol not found
Error relocating /usr/bin/git: pcre_free: symbol not found

再次安装pcre / git可以正常工作。

/ # apk add pcre
(1/2) Installing libcurl (7.56.1-r0)
(2/2) Installing pcre (8.41-r0)
OK: 25 MiB in 17 packages
/ # git
usage: git [--version] [--help] [-C <path>] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

1 个答案:

答案 0 :(得分:4)

我也有这个问题(令人惊讶的是,这是确定性的),并且更换镜像也起作用了。例如,执行:

$ echo "https://mirror.csclub.uwaterloo.ca/alpine/v3.7/main" >/etc/apk/repositories
$ echo "https://mirror.csclub.uwaterloo.ca/alpine/v3.7/community" >>/etc/apk/repositories

将镜像更改为UWaterloo服务器。您可以找到镜像here的完整列表。