mirror of
https://github.com/wassname/ray.git
synced 2026-07-02 03:50:57 +08:00
[docker] docker cp correctly into container (#10253)
This commit is contained in:
@@ -617,6 +617,10 @@ class DockerCommandRunner(SSHCommandRunner):
|
||||
f"mkdir -p {os.path.dirname(target.rstrip('/'))}")
|
||||
self.ssh_command_runner.run_rsync_up(source, target)
|
||||
if self._check_container_status():
|
||||
if os.path.isdir(source):
|
||||
# Adding a "." means that docker copies the *contents*
|
||||
# Without it, docker copies the source *into* the target
|
||||
target += "/."
|
||||
self.ssh_command_runner.run("docker cp {} {}:{}".format(
|
||||
target, self.docker_name,
|
||||
self._docker_expand_user(protected_path)))
|
||||
@@ -627,6 +631,10 @@ class DockerCommandRunner(SSHCommandRunner):
|
||||
source = source.replace("/root", "/tmp/root")
|
||||
self.ssh_command_runner.run(
|
||||
f"mkdir -p {os.path.dirname(source.rstrip('/'))}")
|
||||
if protected_path[-1] == "/":
|
||||
protected_path += "."
|
||||
# Adding a "." means that docker copies the *contents*
|
||||
# Without it, docker copies the source *into* the target
|
||||
self.ssh_command_runner.run("docker cp {}:{} {}".format(
|
||||
self.docker_name, self._docker_expand_user(protected_path),
|
||||
source))
|
||||
|
||||
Reference in New Issue
Block a user