mirror of
https://github.com/vale981/ray
synced 2025-03-06 18:41:40 -05:00
[docker] docker cp
correctly into container (#10253)
This commit is contained in:
parent
07f6cb17e4
commit
f051c2852e
1 changed files with 8 additions and 0 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue