无法在之前安装过的 docker 容器中使用 curl

Can't use curl inside a docker container that has installed it before

我正在使用 RestHeart docker 图片。

来自 dockerfile:

FROM openjdk:8u111-jre-alpine

RUN apk upgrade --update && apk add --update libstdc++ curl ca-certificates bash

...

这意味着当前安装了 curl,对吗?

我运行 Docker 中的那张图片组成:

version: '3.4'
services:

  mongodb:
    image: mongo:4.0
    ports:
      - 27017:27017

  restheart:
    image: softinstigate/restheart:3.10.0
    ports:
      - 8082:8080
    volumes:
      - ./restheart:/opt/restheart/etc:ro
    depends_on:
      - mongodb

restheart 容器的容器 ID 是 e1a023d9a8a9

但是当我执行 docker exec e1a023d9a8a9 curl 我得到:

OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: \"curl\": executable file not found in $PATH": unknown

那个 Docker 文件已经过时了,我不知道为什么 Docker Hub 还在发布那个文件,它至少有两年了!

最新一期在https://github.com/SoftInstigate/restheart/blob/master/core/Dockerfile

RESTHeart v5

因为基础镜像是 gcr.io/distroless/java:11 所以它甚至不包含 sh shell.

顺便说一句,如果有人能告诉我如何更新那个 Docker 文件那将非常有帮助,我在 Docker 中心仪表板中找不到任何 link .


更新(2020 年 5 月 24 日)

从 RESTHeart 5.0.1 开始,我们决定将 Docker 基本映像移动到 adoptopenjdk:11-jre-hotspot-bionic。查看新 Dockerfile.

softinstigate/restheart 图像的 latest and 5.0.1 标签现在都基于 Ubuntu 18.04 LTS 发行版。

distroless 镜像仍然构建(参见 distroless.Dockerfile)并上传到 Docker Hub,但它被标记为 distroless5.0.1-distroless 以区别于默认图像。

发行说明: https://github.com/SoftInstigate/restheart/releases/tag/5.0.1

Docker 枢纽: https://hub.docker.com/repository/docker/softinstigate/restheart

我注意到 restheart 在他们最新的图片中使用了 distroless。但我不明白为什么它不允许 exec 在使用高山的旧图像中。 甚至没有入口点覆盖的运气。

    $ docker run -it --entrypoint=/bin/bash softinstigate/restheart:3.10.0 -c curl
docker: Error response from daemon: OCI runtime create failed: container_linux.go:349: starting container process caused "exec: \"/bin/bash\": stat /bin/bash: no such file or directory": unknown.
ERRO[0000] error waiting for container: context canceled 

但我在本地构建并且它有效。

$ git clone https://github.com/SoftInstigate/restheart.git
$ git checkout tags/4.0.0

代码 3.10.0 在存储库中不可用。

$ cd restheart/Docker

添加Dockerfile

$ docker build --build-arg RELEASE=3.10.0 -t harik8/restheart:latest .
$ docker run -it --entrypoint=/bin/bash harik8/restheart:latest -c curl
curl: try 'curl --help' or 'curl --manual' for more information