将本地文件复制到 k8s 容器时出错
Error while copying local file to k8s container
我正在尝试通过执行以下命令将 jar 文件复制到特定 pod 的容器中。
kubectl cp local_policy.jar podname:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/security
.
我遇到了以下错误。
rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\"tar\\": executable file not found in $PATH\"\n"
请帮忙。
tar 二进制是 运行 cp 所必需的。在kubectl cp的帮助页面:
kubectl cp --help
Copy files and directories to and from containers.
Examples:
# !!!Important Note!!!
# Requires that the 'tar' binary is present in your container
# image. If 'tar' is not present, 'kubectl cp' will fail.
只需在要复制文件的容器to/from 中安装tar
二进制文件。这将允许 kubectl 命令将文件从本地机器复制到目标容器。
在 Amazon linux 上,您可以通过 yum
安装它
yum install tar
我正在尝试通过执行以下命令将 jar 文件复制到特定 pod 的容器中。
kubectl cp local_policy.jar podname:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-0.b14.el7_4.x86_64/jre/lib/security
.
我遇到了以下错误。
rpc error: code = 13 desc = invalid header field value "oci runtime error: exec failed: container_linux.go:247: starting container process caused \"exec: \\"tar\\": executable file not found in $PATH\"\n"
请帮忙。
tar 二进制是 运行 cp 所必需的。在kubectl cp的帮助页面:
kubectl cp --help
Copy files and directories to and from containers.
Examples:
# !!!Important Note!!!
# Requires that the 'tar' binary is present in your container
# image. If 'tar' is not present, 'kubectl cp' will fail.
只需在要复制文件的容器to/from 中安装tar
二进制文件。这将允许 kubectl 命令将文件从本地机器复制到目标容器。
在 Amazon linux 上,您可以通过 yum
yum install tar