kubernetes/build/pause/Dockerfile_windows
Claudiu Belu 3f7c09e601 pause image: Disable DiagTrack service on Windows image
It has been observed that the DiagTrack service in the pause
image is consuming a non-trivial amount of CPU. We don't need
this service in the pause image, so we should disable it.

We can disable the service by running chntpw in a docker buildx Linux stage
and then copy the SYSTEM file back to the final Windows image.

Co-Authored-By: Mark Rossetti <marosset@microsoft.com>
Co-Authored-By: Davanum Srinivas <davanum@gmail.com>
2020-11-04 10:24:25 +00:00

31 lines
1.3 KiB
Plaintext

# Copyright 2020 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
ARG BASE
FROM ${BASE}
ARG ARCH
ADD bin/pause-windows-${ARCH}.exe /pause.exe
ADD bin/wincat-windows-amd64 /Windows/System32/wincat.exe
# NOTE(claudiub): We're replacing the diagtrack.dll as a means to disable the
# DiagTrack service (it cannot run without this DLL). We do not need this
# service in the pause image and there's no reason for it to have any CPU usage.
ADD windows/pause.c /Windows/System32/diagtrack.dll
# NOTE(claudiub): docker buildx sets the PATH env variable to a Linux-like PATH,
# which is not desirable. See: https://github.com/moby/buildkit/issues/1560
# TODO(claudiub): remove this once the issue has been resolved.
ENV PATH="C:\Windows\system32;C:\Windows;"
ENTRYPOINT ["/pause.exe"]