diff options
| author | diogo464 <[email protected]> | 2025-08-18 23:09:37 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-08-18 23:10:59 +0100 |
| commit | bfb030be1ec11e89909e5a2db99d603bd4693ab0 (patch) | |
| tree | 751c775c5c84b35a3d75fab9671e14e44ed9cdf8 /src | |
| parent | e8e42bd6c974c0bb6b53db3a3e4ca5cb3994cfc2 (diff) | |
fixed docker repeated docker pull
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 8e8e5ea..b964d95 100644 --- a/src/main.rs +++ b/src/main.rs | |||
| @@ -496,14 +496,22 @@ async fn cmd_clean(args: CleanArgs) -> Result<()> { | |||
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | fn machine_containers_create_script(containers: &[ScheduledContainer]) -> String { | 498 | fn machine_containers_create_script(containers: &[ScheduledContainer]) -> String { |
| 499 | let images = containers | ||
| 500 | .iter() | ||
| 501 | .map(|c| c.image.clone()) | ||
| 502 | .collect::<HashSet<_>>(); | ||
| 503 | |||
| 499 | let mut script = String::default(); | 504 | let mut script = String::default(); |
| 505 | |||
| 506 | for image in images { | ||
| 507 | script.push_str(&format!("docker pull {} || exit 1\n", image)); | ||
| 508 | } | ||
| 509 | |||
| 500 | for (idx, container) in containers.iter().enumerate() { | 510 | for (idx, container) in containers.iter().enumerate() { |
| 501 | // remove the start signal file if it exists | 511 | // remove the start signal file if it exists |
| 502 | script.push_str("mkdir -p /tmp/oar-p2p-signal\n"); | 512 | script.push_str("mkdir -p /tmp/oar-p2p-signal\n"); |
| 503 | script.push_str("rm /tmp/oar-p2p-signal/start 2>/dev/null || true\n"); | 513 | script.push_str("rm /tmp/oar-p2p-signal/start 2>/dev/null || true\n"); |
| 504 | 514 | ||
| 505 | script.push_str(&format!("docker pull {} || exit 1\n", container.image)); | ||
| 506 | |||
| 507 | script.push_str("docker create \\\n"); | 515 | script.push_str("docker create \\\n"); |
| 508 | script.push_str("\t--pull=never \\\n"); | 516 | script.push_str("\t--pull=never \\\n"); |
| 509 | script.push_str("\t--network=host \\\n"); | 517 | script.push_str("\t--network=host \\\n"); |
