2
votes

I'm using RestHeart docker image.

From it's dockerfile:

FROM openjdk:8u111-jre-alpine

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

...

This means that curl is currently installed, right?

I run that image inside a 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

The container id for restheart container is e1a023d9a8a9.

But when I execute docker exec e1a023d9a8a9 curl I get:

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

2
try docker exec e1a023d9a8a9 bash -c curlclemens
I got: OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknownitalktothewind
oh yes, it's alpine. then /bin/sh -c curl it should beclemens
Again: OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: \"/bin/sh\": stat /bin/sh: no such file or directory": unknownitalktothewind
You can try my compose if you want, is simple as that.italktothewind

2 Answers

3
votes

That Dockerfile is obsolete and I don't know why Docker Hub is still publishing that one, it's at least two years old!

The latest one is at https://github.com/SoftInstigate/restheart/blob/master/core/Dockerfile

It's for RESTHeart v5

As the base image is gcr.io/distroless/java:11 then it does not contain even the sh shell.

By the way, if someone could tell me how to update that Dockerfile that would be very helpful, I can't find any link in the Docker Hub dashboard.


UPDATE (24th may 2020)

Starting from RESTHeart 5.0.1 we have decide to move the Docker base image to adoptopenjdk:11-jre-hotspot-bionic. See the new Dockerfile.

Both the latest and 5.0.1 tags of softinstigate/restheart images are now based on the Ubuntu 18.04 LTS distribution.

The distroless image is still built (see distroless.Dockerfile) and uploaded to Docker Hub, but it is tagged as distroless and 5.0.1-distroless to distinguish it from the default image.

Release notes: https://github.com/SoftInstigate/restheart/releases/tag/5.0.1

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

1
votes

I noticed restheart is using distroless in their latest images. But I couldn't figure out why it's not allowing to exec in older images which are using alpine. Even no luck with entrypoint overriding.

    $ 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 

But I built locally and it works.

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

The tag 3.10.0 is not available at the repo.

$ cd restheart/Docker

Add 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