I have a container parent and container child. child dependsOn
on parent. I think there might be a bug where the generated systemd scripts block each other.
The container config looks something along the lines of:
virtualisation.podman.enable = true;
virtualisation.oci-containers.containers = {
parent= {
user = "root";
image = "parent:latest";
};
child = {
dependsOn = ["parent"];
image = "child:latest";
};
This works fine for nixos-rebuild switch
but after a crash (service probably not stopped properly) and reboot the parent container can not start:
server systemd[1]: Starting podman-parent.service...
server pre-start[90566]: Error: container <HASH_OF_PARENT_CONTAINER> has dependent containers which must be removed before it: <HASH_OF_CHILD_CONTAINER>: container already exists
server podman-parent-start[90618]: Error: container <HASH_OF_PARENT_CONTAINER> has dependent containers which must be removed before it: <HASH_OF_CHILD_CONTAINER>: container already exists
The prestart script of the parent is
#!/nix/store/q1c2flcykgr4wwg5a6h450hxbk4ch589-bash-5.2-p15/bin/bash
set -o errexit
set -o nounset
set -o pipefail
podman rm -f parent || true
rm -f /run/podman-'parent'.ctr-id
I guess this is where it fails while running podman rm -f parent || true
because there are still dependent containers.
Shouldn’t NixOS delete all dependent containers first?