docker download & install openshift命令不工作

rdlzhqv9  于 2023-11-17  发布在  Docker
关注(0)|答案(2)|浏览(113)

我想在docker文件上添加OpenShift CLI 4.6的下载和安装步骤。我已经添加了以下行,但不起作用。

RUN curl -L https://github.com/openshift/okd/releases/download/4.6.0-0.okd-2021-02-14-205305/openshift-client-linux-4.6.0-0.okd-2021-02-14-205305.tar.gz \
   | tar xz && install openshift-client-linux-4.6.0-0.okd-2021-02-14-205305.tar.gz /usr/bin/oc && rm -rf openshift*

字符串
但我得到以下错误

tar (child): openshift-client-linux-4.6.0-0.okd-2021-02-14-205305.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
% Total    % Received % Xferd  Average Speed   Time    Time     Time


电流
curl:(23)写入正文失败(1354!= 1371)

az31mfrm

az31mfrm1#

curl -L https://github.com/openshift/okd/releases/download/4.6.0-0.okd-2021-02-14-205305/openshift-client-linux-4.6.0-0.okd-2021-02-14-205305.tar.gz | tar xz将解压缩tarball中的文件,所以最后,该文件夹中的文件将是下一个:

$ ls
kubectl  oc  README.md

字符串
你可以看到没有openshift-client-linux-4.6.0-0.okd-2021-02-14-205305.tar.gz在那里,如果你真的需要它,你需要做的下一个:
curl -L https://github.com/openshift/okd/releases/download/4.6.0-0.okd-2021-02-14-205305/openshift-client-linux-4.6.0-0.okd-2021-02-14-205305.tar.gz -O将其写入文件夹。

os8fio9y

os8fio9y2#

将此添加到您的Dockerfile:

RUN curl "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/4.14.1/openshift-client-linux-4.14.1.tar.gz" -o "openshift-client-linux.tgz" && \
tar -xvf openshift-client-linux.tgz && \
cp oc /bin/oc && \
cp  kubectl /bin/kubectl && \
rm openshift-client-linux.tgz

字符串

相关问题