Skip to content

dockerfile: remove busybox - #5717

Merged
carles-grafana merged 1 commit into
grafana:mainfrom
carles-grafana:dockerfile_remove_busybox
Oct 15, 2025
Merged

dockerfile: remove busybox#5717
carles-grafana merged 1 commit into
grafana:mainfrom
carles-grafana:dockerfile_remove_busybox

Conversation

@carles-grafana

@carles-grafana carles-grafana commented Oct 8, 2025

Copy link
Copy Markdown
Contributor

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

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@javiermolinar javiermolinar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates friction within the community. For example:
#5558

Do we provide any guidance on how to debug Tempo issues in running containers?

@carles-grafana
carles-grafana force-pushed the dockerfile_remove_busybox branch from fbe3870 to e246afb Compare October 8, 2025 10:17
@carles-grafana

carles-grafana commented Oct 8, 2025

Copy link
Copy Markdown
Contributor Author

It's possible to debug a distroless container using Orbstack or Docker Desktop to open a shell. For Orbstack:
image

@carles-grafana
carles-grafana force-pushed the dockerfile_remove_busybox branch from e246afb to 66ff3ca Compare October 10, 2025 07:45
Comment thread cmd/tempo/Dockerfile

# 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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@carles-grafana
carles-grafana force-pushed the dockerfile_remove_busybox branch from 66ff3ca to 1d6046d Compare October 10, 2025 08:30
Comment thread cmd/tempo/Dockerfile
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"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is chown not needed with this change?

@carles-grafana carles-grafana Oct 14, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@carles-grafana
carles-grafana force-pushed the dockerfile_remove_busybox branch from 1d6046d to 3d47596 Compare October 14, 2025 12:20
@carles-grafana
carles-grafana merged commit bb678d3 into grafana:main Oct 15, 2025
22 checks passed
zhxiaogg pushed a commit to zhxiaogg/tempo that referenced this pull request Jun 5, 2026
To make the Tempo image more minimal, remove busybox, which had vulnerabilities recently.
Update docker-compose files accordingly.

(cherry picked from commit bb678d3)
@zhxiaogg zhxiaogg mentioned this pull request Jun 8, 2026
3 tasks
mattdurham pushed a commit to mattdurham/tempo that referenced this pull request Jun 18, 2026
To make the Tempo image more minimal, remove busybox, which had vulnerabilities recently.
Update docker-compose files accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants