Merge pull request #188795 from Sohalt/oci-containers-wait-for-network

nixos/oci-containers: wait for network before starting container
This commit is contained in:
Nick Cao
2023-01-20 09:11:19 +08:00
committed by GitHub

View File

@@ -230,7 +230,10 @@ let
escapedName = escapeShellArg name;
in {
wantedBy = [] ++ optional (container.autoStart) "multi-user.target";
after = lib.optionals (cfg.backend == "docker") [ "docker.service" "docker.socket" ] ++ dependsOn;
after = lib.optionals (cfg.backend == "docker") [ "docker.service" "docker.socket" ]
# if imageFile is not set, the service needs the network to download the image from the registry
++ lib.optionals (container.imageFile == null) [ "network-online.target" ]
++ dependsOn;
requires = dependsOn;
environment = proxy_env;