dockerfile: remove busybox - #5717
Conversation
javiermolinar
left a comment
There was a problem hiding this comment.
This creates friction within the community. For example:
#5558
Do we provide any guidance on how to debug Tempo issues in running containers?
fbe3870 to
e246afb
Compare
e246afb to
66ff3ca
Compare
|
|
||
| # we need this because some docker-compose files call chown assuming there's a shell | ||
| SHELL ["/busybox/sh", "-c"] | ||
| FROM gcr.io/distroless/static-debian12:debug AS tempo-setup |
There was a problem hiding this comment.
Why don't we use busybox base image directly? It states clearly that the goal of this stage is to create the users and groups. I had to look twice to understand why the gcr.io/distroless/static-debian12:debug was used to. It's also shorter
FROM busybox AS user-setup
RUN addgroup -g 10001 tempo && \
adduser -D -u 10001 -G tempo tempo
There was a problem hiding this comment.
The reason is that in the final stage the /etc/passwd and /etc/group is replaced by those prepared in this stage.
These files in busybox are different to the static-debian12.
I've verified it:
docker run -it busybox
/ # cat /etc/passwd
root:x:0:0:root:/root:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/false
bin:x:2:2:bin:/bin:/bin/false
sys:x:3:3:sys:/dev:/bin/false
sync:x:4:100:sync:/bin:/bin/sync
mail:x:8:8:mail:/var/spool/mail:/bin/false
www-data:x:33:33:www-data:/var/www:/bin/false
operator:x:37:37:Operator:/var:/bin/false
nobody:x:65534:65534:nobody:/home:/bin/false
/ # exit
docker run -it gcr.io/distroless/static-debian12:debug
/ # cat /etc/passwd
root:x:0:0:root:/root:/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/sbin/nologin
nonroot:x:65532:65532:nonroot:/home/nonroot:/sbin/nologin
And in static-debian12:latest, by attaching a shell:
❯ cat /etc/passwd
root:x:0:0:root:/root:/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/sbin/nologin
nonroot:x:65532:65532:nonroot:/home/nonroot:/sbin/nologin
But it's a good question, I'll add a comment to the Dockerfile
66ff3ca to
1d6046d
Compare
| RUN ["/busybox/addgroup", "-g", "10001", "-S", "tempo"] | ||
| RUN ["/busybox/adduser", "-u", "10001", "-S", "tempo", "-G", "tempo"] | ||
| RUN ["/busybox/mkdir", "-p", "/var/tempo", "-m", "0700"] | ||
| RUN ["/busybox/chown", "-R", "tempo:tempo", "/var/tempo"] |
There was a problem hiding this comment.
Is chown not needed with this change?
There was a problem hiding this comment.
chown is now done by the COPY instruction below
To make the Tempo image more minimal, remove busybox, which had vulnerabilities recently. Update docker-compose files accordingly.
1d6046d to
3d47596
Compare
To make the Tempo image more minimal, remove busybox, which had vulnerabilities recently. Update docker-compose files accordingly. (cherry picked from commit bb678d3)
To make the Tempo image more minimal, remove busybox, which had vulnerabilities recently. Update docker-compose files accordingly.

What this PR does:
Months ago, when we switched to distroless images we decided to use the "debug" version, which includes busybox, which could help for debugging purposes.
However, recently busybox had vulnerabilities and the 2.8.2 image is affected.
I propose to remove it to make the image even more minimal and prevent future vulnerabilities. Updated docker-compose files accordingly.
Which issue(s) this PR fixes:
Fixes #
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]