Skip to content

chore!: Remove wget from Promtail docker image - #15101

Merged
chaudum merged 1 commit into
mainfrom
chaudum/remove-wget-from-promtail-image
Nov 27, 2024
Merged

chore!: Remove wget from Promtail docker image#15101
chaudum merged 1 commit into
mainfrom
chaudum/remove-wget-from-promtail-image

Conversation

@chaudum

@chaudum chaudum commented Nov 25, 2024

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The package has been added to the Docker image with PR #11711 with the intention to support the Docker healthcheck.

However, to reduce the attack surface of our Docker images, we want to keep them as slim as possible. The current version of Promtail (3.3.0) for example contains a wget version with vulnerability CVE-2024-38428.

The healthcheck can be achieved by other means, e.g.

  1. Extend the grafana/promtail base image and add wget using apt install wget
    Add wget to promtail Docker image #11590 (comment)
  2. Use low-level /dev/tcp/127.0.0.1:9080 to establish a connection and check the exit code
    Add wget to promtail Docker image #11590 (comment)

Special notes for your reviewer:

Original discussion about adding wget #11590

This may break someone's Docker compose installation, when they require on the wget powered health check.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR
The package has been added to the Docker image with PR #11711 with the
intention to support the Docker healthcheck.

However, to reduce the attack surface of our Docker images, we want to
keep them as slim as possible. The current version of Promtail (3.3.0)
for example contains a wget version with vulnerability
[CVE-2024-38428](https://security-tracker.debian.org/tracker/CVE-2024-38428).

The healthcheck can be achieved by other means, e.g.

1. Extend the `grafana/promtail` base image and add `wget` using `apt
   install wget`
   #11590 (comment)
2. Use low-level `/dev/tcp/127.0.0.1:9080` to establish a connection and
   check the exit code
   #11590 (comment)

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>

@cyriltovena cyriltovena 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.

LGTM

@cstyan cstyan 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.

LGTM 👍

I'd already pointed out the likelihood of our images being modified to pair down dependencies for security reasons in the original issue that asked for the addition of wget to the promtail image #11590 (comment)

@paul1r

paul1r commented Nov 26, 2024

Copy link
Copy Markdown
Collaborator

I'm in favor of this PR, but think we should update the healthchecks in this file before merging. (Not strictly needed for this PR, but would show consistency)

@chaudum

chaudum commented Nov 27, 2024

Copy link
Copy Markdown
Contributor Author

I'm in favor of this PR, but think we should update the healthchecks in this file before merging. (Not strictly needed for this PR, but would show consistency)

The grafana/loki image still contains the wget package since it is part of the alpine base image.

However, I agree, we can add an example how to do the healthcheck with Promtail. We already use Alloy in our examples, so not really necessary IMO

@loki-gh-app

loki-gh-app Bot commented Nov 27, 2024

Copy link
Copy Markdown
Contributor

This PR must be merged before a backport PR will be created.

2 similar comments
@loki-gh-app

loki-gh-app Bot commented Nov 27, 2024

Copy link
Copy Markdown
Contributor

This PR must be merged before a backport PR will be created.

@loki-gh-app

loki-gh-app Bot commented Nov 27, 2024

Copy link
Copy Markdown
Contributor

This PR must be merged before a backport PR will be created.

@chaudum
chaudum merged commit 2eea546 into main Nov 27, 2024
@chaudum
chaudum deleted the chaudum/remove-wget-from-promtail-image branch November 27, 2024 10:31
loki-gh-app Bot pushed a commit that referenced this pull request Nov 27, 2024
The package has been added to the Docker image with PR #11711 with the intention to support the Docker healthcheck.

However, to reduce the attack surface of our Docker images, we want to keep them as slim as possible. The current version of Promtail (3.3.0) for example contains a wget version with vulnerability [CVE-2024-38428](https://security-tracker.debian.org/tracker/CVE-2024-38428).

The healthcheck can be achieved by other means, e.g.

1. Extend the `grafana/promtail` base image and add `wget` using `apt install wget`
   #11590 (comment)
3. Use low-level `/dev/tcp/127.0.0.1:9080` to establish a connection and check the exit code
   #11590 (comment)

Original discussion about adding wget #11590
This may break someone's Docker compose installation, when they require on the `wget` powered health check.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
(cherry picked from commit 2eea546)
loki-gh-app Bot pushed a commit that referenced this pull request Nov 27, 2024
The package has been added to the Docker image with PR #11711 with the intention to support the Docker healthcheck.

However, to reduce the attack surface of our Docker images, we want to keep them as slim as possible. The current version of Promtail (3.3.0) for example contains a wget version with vulnerability [CVE-2024-38428](https://security-tracker.debian.org/tracker/CVE-2024-38428).

The healthcheck can be achieved by other means, e.g.

1. Extend the `grafana/promtail` base image and add `wget` using `apt install wget`
   #11590 (comment)
3. Use low-level `/dev/tcp/127.0.0.1:9080` to establish a connection and check the exit code
   #11590 (comment)

Original discussion about adding wget #11590
This may break someone's Docker compose installation, when they require on the `wget` powered health check.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
(cherry picked from commit 2eea546)
bcotton added a commit to grafana/composables that referenced this pull request Jan 21, 2026
Investigation revealed different base images require different approaches:

Loki (distroless):
- Base image is gcr.io/distroless/static:nonroot with no shell/tools
- Created custom Dockerfile extending grafana/loki:latest
- Added static httpcheck binary from microcheck (~75KB)
- Healthcheck defined in Dockerfile using /bin/httpcheck

Promtail (Ubuntu):
- Base image includes bash but wget removed due to CVE-2024-38428
- Use bash /dev/tcp for TCP port checking on port 9080
- See: grafana/loki#15101

Renderer:
- Base image includes bash but no curl/wget
- Use bash /dev/tcp for TCP port checking on port 8081

All containers now report healthy status and pass manual healthcheck tests.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment