windows_exporter icon indicating copy to clipboard operation
windows_exporter copied to clipboard

Switch to the official host process containers base image

Open jkroepke opened this issue 2 years ago • 11 comments

See: https://github.com/microsoft/windows-host-process-containers-base-image#overview

To reduce the container size of windows_exporter, consider to use this image

mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0 instead the nanoserver once.

jkroepke avatar Jun 07 '23 21:06 jkroepke

/cc. @jsturtevant

profnandaa avatar Jun 13 '23 17:06 profnandaa

I'm happy to take a pull request for this change, but I have no way of testing the new image. Would someone be able to test this?

breed808 avatar Aug 05 '23 22:08 breed808

If you can provide the build image, I able to test it.

jkroepke avatar Aug 09 '23 06:08 jkroepke

You'd have to build it yourself, see the Dockerfile in the project repository. You can change the image there and test both the image build process and running of the built image.

breed808 avatar Aug 20 '23 00:08 breed808

I didn't have any Windows environment with Docker. The AKS nodes are using containerd. Maybe its possible to build intermediate images through Github Actions

jkroepke avatar Aug 20 '23 10:08 jkroepke

I didn't have any Windows environment with Docker

Same here :laughing:. I'll have a look at Github Actions for this, I may be able to build an intermediate image in my forked version of the repo sometime this week

breed808 avatar Aug 20 '23 10:08 breed808

You could use the Azure container registry to build the image.

az acr build --image sample/hello-world:v1
--registry myContainerRegistry008
--file Dockerfile .

https://learn.microsoft.com/en-us/azure/container-registry/container-registry-quickstart-task-cli

PixelRobots avatar Aug 31 '23 07:08 PixelRobots

You can also build windows container on linux, using cross os builds

ARG BASE=mcr.microsoft.com/oss/kubernetes/windows-host-process-containers-base-image:v1.0.0

FROM --platform=$BUILDPLATFORM golang:1.21 as builder
ARG TARGETARCH
ARG TARGETOS

# Get dependencies
WORKDIR /w
COPY go.mod go.sum ./
RUN go mod download
RUN go install github.com/prometheus/promu@latest

# Build windows_exporter
COPY . ./
RUN GOOS=$TARGETOS GOARCH=$TARGETARCH make windows_exporter.exe

FROM $BASE
COPY --from=builder /w/windows_exporter.exe /windows_exporter.exe
ENTRYPOINT ["windows_exporter.exe"]

Then

docker buildx build -t a --platform=windows/amd64 .

jkroepke avatar Nov 05 '23 12:11 jkroepke

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

github-actions[bot] avatar Feb 04 '24 02:02 github-actions[bot]

Unstale

jkroepke avatar Feb 08 '24 19:02 jkroepke

This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

github-actions[bot] avatar May 09 '24 02:05 github-actions[bot]