From 425b6741c67df9ea1e44ec5a23bfea8354e27d79 Mon Sep 17 00:00:00 2001 From: Olivier Clavel Date: Thu, 26 Aug 2021 16:47:23 +0200 Subject: [PATCH] Fix failed image build on pip installing ansible (#7862) Related pip bug: https://stackoverflow.com/questions/68687029/unable-to-build-kubespray-container-from-dockerfile Proposed workaround in comment: https://github.com/pypa/pip/issues/10219#issuecomment-887337037 Setting LANG only prior to launching pip fixes the issue with a successful build --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 98242c444..5450d8d76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,12 @@ RUN curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ && apt update -y && apt-get install --no-install-recommends -y docker-ce \ && rm -rf /var/lib/apt/lists/* +# Some tools like yamllint need this +# Pip needs this as well at the moment to install ansible +# (and potentially other packages) +# See: https://github.com/pypa/pip/issues/10219 +ENV LANG=C.UTF-8 + WORKDIR /kubespray COPY . . RUN /usr/bin/python3 -m pip install --no-cache-dir pip -U \ @@ -25,6 +31,3 @@ RUN KUBE_VERSION=$(sed -n 's/^kube_version: //p' roles/kubespray-defaults/defaul && curl -LO https://storage.googleapis.com/kubernetes-release/release/$KUBE_VERSION/bin/linux/amd64/kubectl \ && chmod a+x kubectl \ && mv kubectl /usr/local/bin/kubectl - -# Some tools like yamllint need this -ENV LANG=C.UTF-8