diff --git a/CHANGELOG-developer.next.asciidoc b/CHANGELOG-developer.next.asciidoc index 0bcca8282b6..c4f2b010258 100644 --- a/CHANGELOG-developer.next.asciidoc +++ b/CHANGELOG-developer.next.asciidoc @@ -70,6 +70,7 @@ The list below covers the major changes between 7.0.0-rc2 and main only. - Debug log entries from the acker (`stateful ack ...` or `stateless ack ...`) removed. {pull}39672[39672] - Rename x-pack/filebeat websocket input to streaming. {issue}40264[40264] {pull}40421[40421] - Journald input now calls `journalctl` instead of using `github.com/coreos/go-systemd/v22@v22.5.0/sdjournal`, the CGO dependency has been removed from Filebeat {pull}40061[40061] +- Use Docker Compose V2 (`docker compose`) instead of Compose V1 (`docker-compose`) {pull}40890[40890] ==== Bugfixes diff --git a/dev-tools/mage/common.go b/dev-tools/mage/common.go index 1c1ca25d95b..1d633373ec1 100644 --- a/dev-tools/mage/common.go +++ b/dev-tools/mage/common.go @@ -216,12 +216,12 @@ func dockerInfo() (*DockerInfo, error) { return &info, nil } -// HaveDockerCompose returns an error if docker-compose is not found on the +// HaveDockerCompose returns an error if docker is not found on the // PATH. func HaveDockerCompose() error { - _, err := exec.LookPath("docker-compose") + _, err := exec.LookPath("docker") if err != nil { - return fmt.Errorf("docker-compose is not available") + return fmt.Errorf("docker is not available") } return nil } diff --git a/dev-tools/mage/integtest_docker.go b/dev-tools/mage/integtest_docker.go index 8c5fb6d3603..7415abf5d0e 100644 --- a/dev-tools/mage/integtest_docker.go +++ b/dev-tools/mage/integtest_docker.go @@ -141,8 +141,8 @@ func (d *DockerIntegrationTester) Test(dir string, mageTarget string, env map[st composeEnv, os.Stdout, os.Stderr, - "docker-compose", - args..., + "docker", + append([]string{"compose"}, args...)..., ) err = saveDockerComposeLogs(dir, mageTarget) @@ -313,8 +313,8 @@ func BuildIntegTestContainers() error { composeEnv, out, os.Stderr, - "docker-compose", args..., - ) + "docker", + append([]string{"compose"}, args...)...) // This sleep is to avoid hitting the docker build issues when resources are not available. if err != nil { @@ -324,8 +324,8 @@ func BuildIntegTestContainers() error { composeEnv, out, os.Stderr, - "docker-compose", args..., - ) + "docker", + append([]string{"compose"}, args...)...) } return err } @@ -348,8 +348,8 @@ func StartIntegTestContainers() error { composeEnv, os.Stdout, os.Stderr, - "docker-compose", - args..., + "docker", + append([]string{"compose"}, args...)..., ) return err } @@ -370,7 +370,7 @@ func StopIntegTestContainers() error { composeEnv, ioutil.Discard, out, - "docker-compose", + "docker", "compose", "-p", DockerComposeProjectName(), "rm", "--stop", "--force", ) @@ -428,7 +428,7 @@ func saveDockerComposeLogs(rootDir string, mageTarget string) error { composeEnv, composeLogFile, // stdout composeLogFile, // stderr - "docker-compose", + "docker", "compose", "-p", DockerComposeProjectName(), "logs", "--no-color", diff --git a/libbeat/tests/compose/wrapper.go b/libbeat/tests/compose/wrapper.go index e2c72cdff37..9e48e93440c 100644 --- a/libbeat/tests/compose/wrapper.go +++ b/libbeat/tests/compose/wrapper.go @@ -168,12 +168,16 @@ func (d *wrapperDriver) cmd(ctx context.Context, command string, arg ...string) } args = append(args, command) args = append(args, arg...) - cmd := exec.CommandContext(ctx, "docker-compose", args...) + cmd := exec.CommandContext(ctx, "docker", append([]string{"compose"}, args...)...) cmd.Stdout = os.Stdout cmd.Stderr = os.Stderr if len(d.Environment) > 0 { cmd.Env = append(os.Environ(), d.Environment...) } + + // Debug message + fmt.Println(">>>>", "docker", strings.Join(append([]string{"compose"}, args...), " ")) + return cmd } diff --git a/testing/environments/Makefile b/testing/environments/Makefile index 6387289ac01..8158227ba31 100644 --- a/testing/environments/Makefile +++ b/testing/environments/Makefile @@ -1,5 +1,5 @@ ENV?=snapshot.yml -BASE_COMMAND=docker-compose -f ${ENV} -f local.yml +BASE_COMMAND=docker compose -f ${ENV} -f local.yml start: # This is run every time to make sure the environment is up-to-date diff --git a/x-pack/winlogbeat/module/testing.go b/x-pack/winlogbeat/module/testing.go index 3dc628b80a9..fb42a9e4156 100644 --- a/x-pack/winlogbeat/module/testing.go +++ b/x-pack/winlogbeat/module/testing.go @@ -81,7 +81,7 @@ func testIngestPipeline(t *testing.T, pipeline, pattern string, p *params) { t.Fatal(err) } if *wintest.KeepRunning { - fmt.Fprintln(os.Stdout, "Use this to manually cleanup containers: docker-compose", "-p", devtools.DockerComposeProjectName(), "rm", "--stop", "--force") + fmt.Fprintln(os.Stdout, "Use this to manually cleanup containers: docker compose", "-p", devtools.DockerComposeProjectName(), "rm", "--stop", "--force") } t.Cleanup(func() { stop := !*wintest.KeepRunning diff --git a/x-pack/winlogbeat/module/wintest/docker.go b/x-pack/winlogbeat/module/wintest/docker.go index 36552aecb79..89d5ccb2759 100644 --- a/x-pack/winlogbeat/module/wintest/docker.go +++ b/x-pack/winlogbeat/module/wintest/docker.go @@ -78,7 +78,7 @@ func saveLogs(env map[string]string, root, target string) error { env, f, // stdout f, // stderr - "docker-compose", + "docker", "compose", "-p", devtools.DockerComposeProjectName(), "logs", "--no-color", @@ -140,7 +140,8 @@ func dockerCompose(env map[string]string, verbose bool) error { env, out, os.Stderr, - "docker-compose", args..., + "docker", + append([]string{"compose"}, args...)..., ) if err == nil { break diff --git a/x-pack/winlogbeat/module/wintest/simulate_test.go b/x-pack/winlogbeat/module/wintest/simulate_test.go index 1bda1d5fb17..90f7a8915c8 100644 --- a/x-pack/winlogbeat/module/wintest/simulate_test.go +++ b/x-pack/winlogbeat/module/wintest/simulate_test.go @@ -48,7 +48,7 @@ func TestSimulate(t *testing.T) { t.Fatal(err) } if *wintest.KeepRunning { - fmt.Fprintln(os.Stdout, "docker-compose", "-p", devtools.DockerComposeProjectName(), "rm", "--stop", "--force") + fmt.Fprintln(os.Stdout, "docker compose", "-p", devtools.DockerComposeProjectName(), "rm", "--stop", "--force") } t.Cleanup(func() { stop := !*wintest.KeepRunning