下载并安装 openshift cli 命令不起作用

download & install openshift cli command not working

我想在 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)

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 将其写入文件夹。