3
0
Fork 0
forked from mirrors/nixpkgs

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
commit cd5c34bb18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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;