Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type RequestContainer struct {
Env map[string]string
ExportedPort []string
Cmd string
RegistryCred string
}

// Container is the struct used to represent a single container.
Expand Down Expand Up @@ -90,6 +91,15 @@ func RunContainer(ctx context.Context, containerImage string, input RequestConta
dockerInput.Cmd = strings.Split(input.Cmd, " ")
}

pullOpt := types.ImagePullOptions{}
if input.RegistryCred != "" {
pullOpt.RegistryAuth = input.RegistryCred
}
_, err = cli.ImagePull(ctx, dockerInput.Image, pullOpt)
if err != nil {
return nil, err
}

resp, err := cli.ContainerCreate(ctx, dockerInput, nil, nil, "")
if err != nil {
return nil, err
Expand Down