不能在以前安装过的docker容器内使用curl

问题描述 投票:1回答: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运行时exec失败:exec失败:container_linux.go:346:正在启动容器进程导致“ exec:\“ curl \”:在以下位置找不到可执行文件$ PATH“:未知

docker docker-compose docker-container restheart
2个回答
0
投票
最新的是在https://github.com/SoftInstigate/restheart/blob/master/core/Dockerfile

适用于RESTHeart v5

因为基本映像是gcr.io/distroless/java:11,所以它甚至都不包含sh shell。

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


0
投票
$ 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
© www.soinside.com 2019 - 2024. All rights reserved.