简体   繁体   English

放入 /bin 时,Distroless 映像无法安装二进制文件

[英]Distroless image fails to install binary when put in /bin

I'm trying to build a Distroless image for Lume .我正在尝试为Lume构建Distroless映像。 It's based on a pre-built image from Deno , so I only have to install the lume executable and make it available in the Distroless image — that's my understanding.它基于Deno的预构建镜像,所以我只需要安装lume可执行文件并使其在Distroless镜像中可用——这是我的理解。

This is what I have so far:这是我到目前为止所拥有的:

FROM docker.io/denoland/deno:debian-1.17.1 AS bin

RUN set -o errexit -o nounset; \
  deno run --allow-all https://deno.land/x/lume@v1.4.2/install.ts

FROM docker.io/denoland/deno:distroless-1.17.1

COPY --from=bin /usr/local/bin/lume /bin/lume

CMD ["lume"]

After running docker build --tag lume-distroless:latest./ , I would expect docker run -it lume-distroless:latest lume --version to successfully be able to use the lume executable and print the version, for instance...but I'm getting this instead:运行docker build --tag lume-distroless:latest./ ,我希望docker run -it lume-distroless:latest lume --version能够成功使用lume可执行文件并打印版本,例如...但我得到了这个:

$ docker run -it lume-distroless:latest lume --version 
error: Found argument 'lume' which wasn't expected, or isn't valid in this context

USAGE:
    deno [OPTIONS] [SUBCOMMAND]

For more information try --help

Any clues what am I missing here?任何线索我在这里错过了什么?

I would accept a Pull Request with the solution against this issue as well.我也会接受针对此问题的解决方案的拉取请求。

The image you built is configured to execute the deno executable on container startup.您构建的映像配置为在容器启动时执行deno可执行文件。

To run lume , you have two options:要运行lume ,您有两种选择:

  1. Use an ENTRYPOINT command in your Dockerfile, like ENTRYPOINT ["/bin/lume"] , then build a new image.在 Dockerfile 中使用ENTRYPOINT命令,例如ENTRYPOINT ["/bin/lume"] ,然后构建一个新图像。 You can then use docker run -it lume-distroless:latest --version然后您可以使用docker run -it lume-distroless:latest --version

  2. Overwrite the entrypoint when starting a container, like docker run -it --entrypoint=/bin/lume lume-distroless:latest --version启动容器时覆盖入口点,如docker run -it --entrypoint=/bin/lume lume-distroless:latest --version

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

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