How to install tar binary in my Kubernetes container for kubectl cp to work?

Viewed 918

My kubectl cp isnt working due to tar not being in my bin folder of my container. I can't seem to find how to get it installed.

I get an error when trying:

kubectl cp /tmp/foo_dir <some-pod>:/tmp/bar_dir

Error:

rpc error: code = 2 desc = oci runtime error: exec failed: container_linux.go:235: starting container process caused "exec: "tar": executable file not found in $PATH"

1 Answers

It looks like there is no Tar into your Docker

I would suggest installing the Tar first at the above Dockerfile level commands

You can add the Tar into Docker using

Docker image : RUN yum install -y tar

Related