mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 16:03:23 +00:00
nixos/oci-containers: check if image exists locally before failing
Signed-off-by: budimanjojo <budimanjojo@gmail.com>
This commit is contained in:
parent
4477ea4df7
commit
fd3fa9f2d3
@ -252,10 +252,13 @@ let
|
||||
text = ''
|
||||
${cfg.backend} rm -f ${name} || true
|
||||
${optionalString (isValidLogin container.login) ''
|
||||
# try logging in, if it fails, check if image exists locally
|
||||
${cfg.backend} login \
|
||||
${container.login.registry} \
|
||||
--username ${container.login.username} \
|
||||
--password-stdin < ${container.login.passwordFile}
|
||||
--password-stdin < ${container.login.passwordFile} \
|
||||
|| ${cfg.backend} image inspect ${container.image} >/dev/null \
|
||||
|| { echo "image doesn't exist locally and login failed" >&2 ; exit 1; }
|
||||
''}
|
||||
${optionalString (container.imageFile != null) ''
|
||||
${cfg.backend} load -i ${container.imageFile}
|
||||
|
Loading…
Reference in New Issue
Block a user