Skip to content

Commit c4cadca

Browse files
authored
Merge pull request #3477 from dgl/dockerfile-perms
Avoid setting /kind/bin to 0644
2 parents 2ad380d + 42024a9 commit c4cadca

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

images/base/Dockerfile

+6-5
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ ARG BASE_IMAGE=debian:bookworm-slim
2424
FROM $BASE_IMAGE as base
2525

2626
# copy in static files
27-
# all scripts are 0755 (rwx r-x r-x)
27+
# all scripts and directories are 0755 (rwx r-x r-x)
2828
# all non-scripts are 0644 (rw- r-- r--)
2929
COPY --chmod=0755 files/usr/local/bin/* /usr/local/bin/
3030

3131
COPY --chmod=0644 files/kind/ /kind/
32-
COPY --chmod=0755 files/kind/bin/* /kind/bin/
32+
# COPY only applies to files, not the directory itself, so the permissions are
33+
# fixed in RUN below with a chmod.
34+
COPY --chmod=0755 files/kind/bin/ /kind/bin/
3335

3436
COPY --chmod=0644 files/LICENSES/* /LICENSES/*
3537
COPY --chmod=0644 files/etc/* /etc/
@@ -42,8 +44,6 @@ COPY --chmod=0644 files/etc/systemd/system/kubelet.service.d/* /etc/systemd/syst
4244
# Install dependencies, first from apt, then from release tarballs.
4345
# NOTE: we use one RUN to minimize layers.
4446
#
45-
# First we must ensure that our util scripts are executable.
46-
#
4747
# The base image already has a basic userspace + apt but we need to install more packages.
4848
# Packages installed are broken down into (each on a line):
4949
# - packages needed to run services (systemd)
@@ -69,7 +69,8 @@ COPY --chmod=0644 files/etc/systemd/system/kubelet.service.d/* /etc/systemd/syst
6969
# Finally we adjust tempfiles cleanup to be 1 minute after "boot" instead of 15m
7070
# This is plenty after we've done initial setup for a node, but before we are
7171
# likely to try to export logs etc.
72-
RUN echo "Installing Packages ..." \
72+
RUN chmod 755 /kind/bin && \
73+
echo "Installing Packages ..." \
7374
&& DEBIAN_FRONTEND=noninteractive clean-install \
7475
systemd \
7576
conntrack iptables iproute2 ethtool util-linux mount ebtables kmod \

0 commit comments

Comments
 (0)