dockerdocker-composedocker-containerrestheart

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


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


Solution

  • 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