minikube 与本地机器之间传递文件

minikube scp About 1,386 words

使用 scp 命令

scp -i $(minikube ssh-key) <local-path> docker@$(minikube ip):<remote-path>

示例

scp -i $(minikube ssh-key) /media/myuser/sourceFolder docker@$(minikube ip):/home/docker/destiationFolder

使用 minikube cp 命令 (推荐)

minikube cp

查看帮助

PS C:\> minikube cp --help
Copy the specified file into minikube, it will be saved at path <target file absolute path> in your minikube.
Default target node controlplane and If <source node name> is omitted, It will trying to copy from host.

Example Command : "minikube cp a.txt /home/docker/b.txt" +
                  "minikube cp a.txt minikube-m02:/home/docker/b.txt"
                  "minikube cp minikube-m01:a.txt minikube-m02:/home/docker/b.txt"

Usage:
  minikube cp <source node name>:<source file path> <target node name>:<target file absolute path> [flags] [options]

宿主机拷贝到 minikube

不添加具体源node代表从本地机器拷贝,不添加目标node代表传输到controlplane节点。

minikube cp C:\a.txt /home/docker/a.txt

minikube 拷贝到宿主机

必须添加node名称

minikube cp minikube:/home/docker/a.txt C:\bbb.txt

必须添加node名称,否则会报错:

PS C:\> minikube cp /home/docker/a.txt C:\bbb.txt

❌  Exiting due to MK_USAGE: Target <remote file path> must be an absolute Path. Relative Path is not allowed (example: "minikube:/home/docker/copied.txt")

指定节点拷贝到指定节点

查看节点可使用minikube node list命令

minikube cp minikube-m01:a.txt minikube-m02:/home/docker/b.txt
Views: 1,763 · Posted: 2022-11-21

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh