2

我正在使用 RestHeart 泊坞窗图像。

从它的dockerfile

FROM openjdk:8u111-jre-alpine

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

...

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

我在 Docker compose 中运行该图像:

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 运行时执行失败:执行失败:container_linux.go:346:启动容器进程导致“exec:\”curl\“:$PATH 中找不到可执行文件”:未知

4

2 回答 2

3

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

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

适用于 RESTHeart v5

由于基础映像是 gcr.io/distroless/java:11,因此它甚至不包含 sh shell。

顺便说一句,如果有人能告诉我如何更新非常有用的 Dockerfile,我在 Docker Hub 仪表板中找不到任何链接。


更新(2020 年 5 月 24 日)

从 RESTHeart 5.0.1 开始,我们决定将 Docker 基础镜像移动到adoptopenjdk:11-jre-hotspot-bionic. 请参阅新的Dockerfile

最新5.0.1标签的图像现在都softinstigate/restheart基于 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

于 2020-05-20T16:10:28.857 回答
1

我注意到 restheartdistroless在他们的最新图片中使用。但我无法弄清楚为什么它不允许exec在使用 alpine 的旧图像中使用。即使入口点覆盖也没有运气。

    $ 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在 repo 中不可用。

$ 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
于 2020-05-20T16:21:52.343 回答