mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 14:10:33 +03: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
1 changed files with 4 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue