From 7025edf6d616c7fe511c4aa2288a7ef2f3fdf5ae Mon Sep 17 00:00:00 2001 From: fj0r <82698591+fj0r@users.noreply.github.com> Date: Sat, 17 Feb 2024 23:02:24 +0800 Subject: [PATCH] fix container-create (#759) Co-authored-by: nash --- modules/docker/docker.nu | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/modules/docker/docker.nu b/modules/docker/docker.nu index 98a9c3110..0b766b87c 100644 --- a/modules/docker/docker.nu +++ b/modules/docker/docker.nu @@ -11,16 +11,6 @@ def --wrapped with-flag [...flag] { if ($in | is-empty) { [] } else { [...$flag $in] } } -def local_image [name] { - let s = $name | split row '/' - if ($s | length) > 1 { - $name - } else { - ['localhost', $name] | str join '/' - } - -} - def "nu-complete docker ns" [] { if $env.docker-cli == 'nerdctl' { ^$env.docker-cli namespace list @@ -267,7 +257,9 @@ export def image-push [ ^$env.docker-cli ...($n | with-flag -n) ...$insecure push $img } else { ^$env.docker-cli ...($n | with-flag -n) tag $img $tag - ^$env.docker-cli ...($n | with-flag -n) ...$insecure push $tag + do -i { + ^$env.docker-cli ...($n | with-flag -n) ...$insecure push $tag + } ^$env.docker-cli ...($n | with-flag -n) rmi $tag } } @@ -393,7 +385,6 @@ export def container-create [ if $dry_run { echo ([docker $ns run --name $name $args $img $cmd] | flatten | str join ' ') } else { - let $img = if $env.docker-cli == 'nerdctl' { local_image $img } else { $img } ^$env.docker-cli ...$ns run --name $name ...$args $img ...($cmd | flatten) } }