This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ec2Service.TerminateInstancesRequest(&ec2.TerminateInstancesInput{ | |
DryRun: aws.Bool(dryRun), | |
InstanceIds: []*string{runInstanceResponse.Instances[0].InstanceId}, | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inspect, errInspect := newClient.ContainerInspect(ctx, resp.ID) | |
Inspect := inspect.State.ExitCode |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newClient.ContainerStop(context.Background(), resp.ID, &timeout) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//if no error, grab the logs | |
logs, errLogs := newClient.ContainerLogs(ctx, resp.ID, ops) | |
if errLogs == nil { | |
scanner := bufio.NewScanner(logs) | |
for scanner.Scan() { | |
log.Printf("docker | %s", scanner.Text()) | |
} | |
_ = reader.Close() | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//attempt to start the container, notice the response id from container create API | |
newClient.ContainerStart(ctx, resp.ID, types.ContainerStartOptions{}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resp, err := newClient.ContainerCreate(ctx, config, &container.HostConfig{ | |
NetworkMode: "host", //might require a different setting, here we need the container exposed to the subnet | |
}, nil, "name") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
scanner := bufio.NewScanner(reader) | |
for scanner.Scan() { | |
log.Printf("docker | %s", scanner.Text()) | |
} | |
_ = reader.Close() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
reader, err := newClient.ImagePull(ctx, image, types.ImagePullOptions{ | |
RegistryAuth: authStr, | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
decoded, e := base64.StdEncoding.DecodeString(token) | |
parts := strings.Split(decoded, ":") | |
authConfig := types.AuthConfig{ | |
Username: parts[0], | |
Password: parts[1], | |
} | |
encodedJSON, err := json.Marshal(authConfig) | |
authStr := base64.URLEncoding.EncodeToString(encodedJSON) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tokenRequest, errToken := ecrService.GetAuthorizationToken(&ecr.GetAuthorizationTokenInput{}) | |
if errToken != nil { | |
log.Fatalf("couldn't retrieve ecr login details! %v", errToken) | |
} | |
token := *tokenRequest.AuthorizationData[0].AuthorizationToken |
NewerOlder