mirror of
https://github.com/portainer/portainer.git
synced 2025-07-21 22:39:41 +02:00
fix(api): ignore Docker login errors during stack deployment (#1635)
This commit is contained in:
parent
1c67db0c70
commit
1de0619fd5
3 changed files with 6 additions and 18 deletions
|
@ -23,27 +23,19 @@ func NewStackManager(binaryPath string) *StackManager {
|
|||
}
|
||||
|
||||
// Login executes the docker login command against a list of registries (including DockerHub).
|
||||
func (manager *StackManager) Login(dockerhub *portainer.DockerHub, registries []portainer.Registry, endpoint *portainer.Endpoint) error {
|
||||
func (manager *StackManager) Login(dockerhub *portainer.DockerHub, registries []portainer.Registry, endpoint *portainer.Endpoint) {
|
||||
command, args := prepareDockerCommandAndArgs(manager.binaryPath, endpoint)
|
||||
for _, registry := range registries {
|
||||
if registry.Authentication {
|
||||
registryArgs := append(args, "login", "--username", registry.Username, "--password", registry.Password, registry.URL)
|
||||
err := runCommandAndCaptureStdErr(command, registryArgs, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
runCommandAndCaptureStdErr(command, registryArgs, nil)
|
||||
}
|
||||
}
|
||||
|
||||
if dockerhub.Authentication {
|
||||
dockerhubArgs := append(args, "login", "--username", dockerhub.Username, "--password", dockerhub.Password)
|
||||
err := runCommandAndCaptureStdErr(command, dockerhubArgs, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
runCommandAndCaptureStdErr(command, dockerhubArgs, nil)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Logout executes the docker logout command.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue