mirror of
https://github.com/containrrr/watchtower.git
synced 2025-12-14 22:20:12 +01:00
Support loading authentication credentials from Docker config file
This commit is contained in:
parent
79320bb4b6
commit
dad5d58339
3 changed files with 38 additions and 9 deletions
|
|
@ -147,10 +147,13 @@ func (client dockerClient) IsContainerStale(c Container) (bool, error) {
|
|||
log.Debugf("Pulling %s for %s", imageName, c.Name())
|
||||
|
||||
var opts types.ImagePullOptions // ImagePullOptions can take a RegistryAuth arg to authenticate against a private registry
|
||||
auth, err := EncodedEnvAuth(imageName)
|
||||
auth, err := EncodedAuth(imageName)
|
||||
if err != nil {
|
||||
log.Debug("No authentication credentials found")
|
||||
opts = types.ImagePullOptions{}
|
||||
log.Debugf("Error loading authentication credentials %s", err)
|
||||
return false, err
|
||||
} else if auth == "" {
|
||||
log.Debugf("No authentication credentials found for %s", imageName)
|
||||
opts = types.ImagePullOptions{} // empty/no auth credentials
|
||||
} else {
|
||||
opts = types.ImagePullOptions{RegistryAuth: auth, PrivilegeFunc: DefaultAuthHandler}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue