TAMIM HAIDER
TAMIM HAIDER

Reputation: 719

download & install openshift cli command not working

I want to add the download and installation step of OpenShift CLI 4.6 on a docker file. I have added the following lines but it's not working.

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*

But I am getting the following error

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 

Current

curl: (23) Failed writing body (1354 != 1371)

Upvotes: 0

Views: 5390

Answers (2)

Jochen
Jochen

Reputation: 11

Add this to your 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

Upvotes: 0

atline
atline

Reputation: 31574

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 will extract the files in the tarball, so finally, the files in that folder would be next:

$ ls
kubectl  oc  README.md

You could see no openshift-client-linux-4.6.0-0.okd-2021-02-14-205305.tar.gz there, if you really need it, you need do as next:

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 to write it to folder.

Upvotes: 3

Related Questions