Sh:在 alpine Docker 图像上找不到文件

Sh : file not found on alpine Docker image

我在我的 Raspberry Pi3 上安装了 Docker。 我想安装 "registry" 图像。由于我没有在ARM中找到它,所以我已经构建了一个AMR版本。

我从 git https://github.com/docker/distribution/

重新编译了二进制文件

我得到一个功能二进制文件:

# registry --version
src_docker/go/bin/registry github.com/docker/distribution v2.6.0+unknown

然后我离开了 git https://github.com/docker/distribution-library-image 来自定义 Docker 文件。

FROM arm32v6/alpine:3.5

RUN set -ex \
   && apk add --no-cache ca-certificates apache2-utils

COPY ./registry/registry /bin/registry
COPY ./registry/config-example.yml /etc/docker/registry/config.yml

VOLUME ["/var/lib/registry"]
EXPOSE 5000

COPY docker-entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

CMD ["/etc/docker/registry/config.yml"]

我当然要用我编译的二进制文件替换 "registry / registry"。

我构建镜像:

docker build . -t ikise_arm/registry

但是当我执行图像时它没有找到二进制文件

# docker run -ti ikise_arm/registry:latest
/entrypoint.sh: exec: line 10: registry: not found

如果我禁用 ENTRYPOINT 并浏览文件,我会找到二进制文件但无法执行

# docker run -ti ikise_arm/registry:latest
/ # ls -al /bin/r*
lrwxrwxrwx    1 root     root            12 Mar  2 20:19 /bin/reformime -> /bin/busybox
-rwxr-xr-x    1 root     root      19940588 Jun 14 12:27 /bin/registry
lrwxrwxrwx    1 root     root            12 Mar  2 20:19 /bin/rev -> /bin/busybox
lrwxrwxrwx    1 root     root            12 Mar  2 20:19 /bin/rm -> /bin/busybox
lrwxrwxrwx    1 root     root            12 Mar  2 20:19 /bin/rmdir -> /bin/busybox
lrwxrwxrwx    1 root     root            12 Mar  2 20:19 /bin/run-parts -> /bin/busybox
/ # /bin/registry
sh: /bin/registry: not found

您知道问题出在哪里吗?

所以我调整了图片https://github.com/docker-library/golang/tree/master/1.8/alpine3.6 编译二进制注册表

(https://github.com/gliderlabs/docker-alpine/issues/78)