mirror of
https://codeberg.org/Mo8it/server_dotfiles.git
synced 2024-09-17 18:51:17 +00:00
stop container if exists
This commit is contained in:
parent
a626027478
commit
f0738fd218
1 changed files with 9 additions and 4 deletions
|
@ -3,19 +3,24 @@ set -p PATH "$HOME/.cargo/bin"
|
|||
|
||||
# Non interactive functions
|
||||
function podman-default-create -w podman
|
||||
set -l container_name $argv[1]
|
||||
|
||||
if podman container exists $container_name
|
||||
podman stop $container_name
|
||||
end
|
||||
|
||||
podman create \
|
||||
--name $argv[1] \
|
||||
--detach \
|
||||
--name $container_name \
|
||||
--pull always \
|
||||
--label "io.containers.autoupdate=registry" \
|
||||
$argv[2..]
|
||||
|
||||
set -l old_pwd (pwd)
|
||||
cd ~/.config/systemd/user
|
||||
podman generate systemd --new --files --name $argv[1]
|
||||
podman generate systemd --new --files --name $container_name
|
||||
cd $old_pwd
|
||||
|
||||
systemctl --user enable --now container-$argv[1]
|
||||
systemctl --user enable --now container-$container_name
|
||||
end
|
||||
|
||||
if status is-interactive
|
||||
|
|
Loading…
Reference in a new issue