dockeralpine-linuxopen-telemetry-collector

sh for open telemetry-collector-contrib image


I have that image (based on alpine)

otel/opentelemetry-collector-contrib:0.90.0

And try to open sh by some of that commands:

docker exec -it container_name /bin/bash
docker exec -it container_name /bin/ash
docker exec -it container_name /bin/sh
docker exec -it container_name ash
docker exec -it container_name sh

And no of these commands working for me...

How can I open terminal for that image?


Solution

  • If we run the image:

    docker run -it --rm --name otel otel/opentelemetry-collector-contrib:0.90.0
    

    And then get the container pid:

    pid=$(docker container inspect otel --format '{{ .State.Pid }}')
    

    We can inspect the container root filesystem like this:

    sudo ls -l /proc/$pid/root/
    

    Which shows us that the image contains only a single binary:

    total 220580
    drwxr-xr-x.   5 lars lars       360 Aug  2 20:00 dev
    drwxr-xr-x.   1 lars lars        78 Aug  2 20:00 etc
    -rwxr-xr-x.   1 lars lars 225873920 Nov 28  2023 otelcol-contrib
    dr-xr-xr-x. 504 root root         0 Aug  2 20:00 proc
    drwxr-xr-x.   1 lars lars        40 Aug  2 20:00 run
    dr-xr-xr-x.  13 root root         0 Jul 28 19:04 sys
    

    (And a smattering of files in /etc).

    There is no shell available in the container.