diff options
author | Nick Cao <nickcao@nichi.co> | 2023-01-20 09:11:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-20 09:11:19 +0800 |
commit | cd5c34bb18f2bc7ba716dbde2dc7ceaccd351e98 (patch) | |
tree | 1f7794a10d006b894a677c5255a37429e6f3c609 /nixos/modules/virtualisation | |
parent | f0a314a98820b94de90a0abb44ffa09a80b72a20 (diff) | |
parent | 995853d13c53c182781b14e00b91ea20ce98257f (diff) |
Merge pull request #188795 from Sohalt/oci-containers-wait-for-network
nixos/oci-containers: wait for network before starting container
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r-- | nixos/modules/virtualisation/oci-containers.nix | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix index 61066c3cbd75..a9f4ab77f866 100644 --- a/nixos/modules/virtualisation/oci-containers.nix +++ b/nixos/modules/virtualisation/oci-containers.nix @@ -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; |