From 156efb84636342f6c2aa3a456278a6f98c6d8173 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Wed, 24 Feb 2021 15:23:56 +0100 Subject: [PATCH] Scan suggest message in docker compose build Signed-off-by: Guillaume Tardif --- local/compose/build.go | 8 ++++++++ local/e2e/compose/fixtures/build-test/compose.yml | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/local/compose/build.go b/local/compose/build.go index 78f5426a3..1e35befd4 100644 --- a/local/compose/build.go +++ b/local/compose/build.go @@ -127,6 +127,14 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opts if err == nil { err = errW } + if err == nil { + commands := make([]string, 0, len(opts)) + for image, _ := range opts { + commands = append(commands, fmt.Sprintf("docker scan %s", image)) + } + allCommands := strings.Join(commands, ", ") + fmt.Printf("Try scanning the image you have just built to identify vulnerabilities with Docker’s new security tool: %s\n", allCommands) + } return err } diff --git a/local/e2e/compose/fixtures/build-test/compose.yml b/local/e2e/compose/fixtures/build-test/compose.yml index 0e7f2c123..1ccd3234e 100644 --- a/local/e2e/compose/fixtures/build-test/compose.yml +++ b/local/e2e/compose/fixtures/build-test/compose.yml @@ -6,4 +6,4 @@ services: nginx2: build: nginx-build - image: custom-nginx + image: gtardif/custom-nginx