sync-containers3: remove interface at container shutdown to avoid stuck containers

This commit is contained in:
lassulus 2023-12-05 15:20:49 +01:00
parent c660bedbb9
commit 3c84e73710
1 changed files with 3 additions and 0 deletions

View File

@ -246,6 +246,9 @@ in {
}; }
{ "container@${ctr.name}" = lib.mkIf ctr.runContainer {
serviceConfig = {
ExecStop = pkgs.writers.writeDash "remove_interface" ''
${pkgs.iproute2}/bin/ip link del vb-${ctr.name}
'';
ExecStartPost = [
(pkgs.writers.writeDash "bind-to-bridge" ''
${pkgs.iproute2}/bin/ip link set "vb-$INSTANCE" master ctr0