lium cp
Copy files from one pod to another directly over SSH. The data goes pod to pod and never through your machine.
lium cp SRC_POD:PATH DST_POD:PATH [OPTIONS]
Arguments
SRC_POD:PATH— The source pod and the path on it. A trailing/on a directory copies its contents, as in rsync.DST_POD:PATH— The destination pod and the path on it.
POD is a name, huid, id or index from lium ps, and must match exactly one pod. Both pods must be RUNNING with an SSH connection. For copies between your machine and a pod use lium scp or lium rsync.
Options
| Flag | Effect |
|---|---|
--bwlimit KIB_PER_S | Cap the transfer rate (rsync --bwlimit) |
--exclude PATTERN | Skip matching paths; repeatable (rsync --exclude) |
--delete | Remove files at the destination that are not in the source |
--json | Print machine-readable JSON |
How it works
The CLI creates a one-off SSH key on your machine, places its private half on the source pod and authorizes its public half on the destination for the duration of the copy, runs rsync from the source to the destination, then removes both halves. If that cleanup fails, the CLI warns and names the command that revokes the key.
Both pods need rsync (apt-get install -y rsync). The destination also needs flock (util-linux, present on every Ubuntu and Debian image), which keeps two copies into the same pod from running at once.
Examples
lium cp dev-pod:/workspace/src train-pod:/workspace/
lium cp 1:/workspace/ckpt/ 2:/workspace/ckpt/ --exclude '*.tmp' --bwlimit 50000
lium cp 1:/data/ 2:/data/ --delete --json
--json prints {"ok": true, "source": {"pod", "path"}, "destination": {"pod", "path"}, "exit_code"}.
Errors
| Code | Exit | When |
|---|---|---|
invalid_arguments | 2 | A side has no POD: part, or a pod reference matches more than one pod |
pod_not_found | 5 | No pod matches |
ssh_unavailable | 4 | A pod is not RUNNING or has no SSH connection yet |
ssh_host_key_unknown | 4 | The destination's host key is not pinned yet: connect once with lium ssh <pod>, or set LIUM_SSH_INSECURE=1 |
copy_failed | 1 | rsync or the key grant failed on a pod; the message carries rsync's own error |
See also
lium scp— copy between your machine and podslium rsync— sync directories between your machine and pods