From 24306fd49d9e650ee4e1639a1327a25131e63f8e Mon Sep 17 00:00:00 2001 From: Antoine Cotten Date: Tue, 17 Sep 2024 09:20:56 +0200 Subject: [PATCH] feat!: Remove support for Compose v1 There has been no release of the deprecated 'docker-compose' Python package since v1.29.2, which was published in May 2021[1]. This release is currently broken due to a breaking change in the 'docker' Python package at version 7.0.0[1], and there is seemlingly no plan to release a patch version of Compose v1 to address the problem. The official path forward is to use Compose v2, which is now bundled with the Docker client and available on all platforms where Docker is supported. This commit additionally removes the 'version' attribute from Compose files, since it was obsoleted in the Compose Spec[3]. Closes #1017 [1]: https://pypi.org/project/docker-compose/#history [2]: docker/docker-py#3194 [3]: https://compose-spec.io --- README.md | 29 +++++++++---------- docker-compose.yml | 2 -- extensions/curator/README.md | 2 +- extensions/curator/curator-compose.yml | 2 -- extensions/enterprise-search/README.md | 4 +-- .../enterprise-search-compose.yml | 2 -- extensions/filebeat/README.md | 4 +-- extensions/filebeat/filebeat-compose.yml | 2 -- extensions/fleet/README.md | 2 +- extensions/fleet/agent-apmserver-compose.yml | 4 +-- extensions/fleet/fleet-compose.yml | 2 -- extensions/heartbeat/README.md | 4 +-- extensions/heartbeat/heartbeat-compose.yml | 2 -- extensions/metricbeat/README.md | 4 +-- extensions/metricbeat/metricbeat-compose.yml | 2 -- 15 files changed, 25 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 3dd0d24..ee046c2 100644 --- a/README.md +++ b/README.md @@ -32,11 +32,11 @@ Other available stack variants: ## tl;dr ```sh -docker-compose up setup +docker compose up setup ``` ```sh -docker-compose up +docker compose up ``` ![Animated demo](https://user-images.githubusercontent.com/3299086/155972072-0c89d6db-707a-47a1-818b-5f976565f95a.gif) @@ -91,7 +91,7 @@ own_. [sherifabdlnaby/elastdocker][elastdocker] is one example among others of p ### Host setup * [Docker Engine][docker-install] version **18.06.0** or newer -* [Docker Compose][compose-install] version **1.28.0** or newer (including [Compose V2][compose-v2]) +* [Docker Compose][compose-install] version **2.0.0** or newer * 1.5 GB of RAM > [!NOTE] @@ -128,7 +128,7 @@ instructions from the [documentation][mac-filesharing] to add more locations. ## Usage > [!WARNING] -> You must rebuild the stack images with `docker-compose build` whenever you switch branch or update the +> You must rebuild the stack images with `docker compose build` whenever you switch branch or update the > [version](#version-selection) of an already existing stack. ### Bringing up the stack @@ -142,13 +142,13 @@ git clone https://github.com/deviantony/docker-elk.git Then, initialize the Elasticsearch users and groups required by docker-elk by executing the command: ```sh -docker-compose up setup +docker compose up setup ``` If everything went well and the setup completed without error, start the other stack components: ```sh -docker-compose up +docker compose up ``` > [!NOTE] @@ -186,15 +186,15 @@ reset the passwords of all aforementioned Elasticsearch users to random secrets. of them. ```sh - docker-compose exec elasticsearch bin/elasticsearch-reset-password --batch --user elastic + docker compose exec elasticsearch bin/elasticsearch-reset-password --batch --user elastic ``` ```sh - docker-compose exec elasticsearch bin/elasticsearch-reset-password --batch --user logstash_internal + docker compose exec elasticsearch bin/elasticsearch-reset-password --batch --user logstash_internal ``` ```sh - docker-compose exec elasticsearch bin/elasticsearch-reset-password --batch --user kibana_system + docker compose exec elasticsearch bin/elasticsearch-reset-password --batch --user kibana_system ``` If the need for it arises (e.g. if you want to [collect monitoring information][ls-monitoring] through Beats and @@ -223,7 +223,7 @@ reset the passwords of all aforementioned Elasticsearch users to random secrets. 1. Restart Logstash and Kibana to re-connect to Elasticsearch using the new passwords ```sh - docker-compose up -d logstash kibana + docker compose up -d logstash kibana ``` > [!NOTE] @@ -260,7 +260,7 @@ Elasticsearch data is persisted inside a volume by default. In order to entirely shutdown the stack and remove all persisted data, use the following Docker Compose command: ```sh -docker-compose down -v +docker compose down -v ``` ### Version selection @@ -269,7 +269,7 @@ This repository stays aligned with the latest version of the Elastic stack. The version (8.x). To use a different version of the core Elastic components, simply change the version number inside the [`.env`](.env) -file. If you are upgrading an existing stack, remember to rebuild all container images using the `docker-compose build` +file. If you are upgrading an existing stack, remember to rebuild all container images using the `docker compose build` command. > [!IMPORTANT] @@ -359,7 +359,7 @@ To run the setup container again and re-initialize all users for which a passwor simply "up" the `setup` Compose service again: ```console -$ docker-compose up setup +$ docker compose up setup ⠿ Container docker-elk-elasticsearch-1 Running ⠿ Container docker-elk-setup-1 Created Attaching to docker-elk-setup-1 @@ -393,7 +393,7 @@ To add plugins to any ELK component you have to: 1. Add a `RUN` statement to the corresponding `Dockerfile` (eg. `RUN logstash-plugin install logstash-filter-json`) 1. Add the associated plugin code configuration to the service configuration (eg. Logstash input/output) -1. Rebuild the images using the `docker-compose build` command +1. Rebuild the images using the `docker compose build` command ### How to enable the provided extensions @@ -471,7 +471,6 @@ See the following Wiki pages: [docker-install]: https://docs.docker.com/get-docker/ [compose-install]: https://docs.docker.com/compose/install/ -[compose-v2]: https://docs.docker.com/compose/compose-v2/ [linux-postinstall]: https://docs.docker.com/engine/install/linux-postinstall/ [bootstrap-checks]: https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html diff --git a/docker-compose.yml b/docker-compose.yml index 99dced1..e7c07b9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: # The 'setup' service runs a one-off script which initializes users inside diff --git a/extensions/curator/README.md b/extensions/curator/README.md index 5c38786..e19ebe7 100644 --- a/extensions/curator/README.md +++ b/extensions/curator/README.md @@ -8,7 +8,7 @@ If you want to include the Curator extension, run Docker Compose from the root o command line argument referencing the `curator-compose.yml` file: ```bash -$ docker-compose -f docker-compose.yml -f extensions/curator/curator-compose.yml up +$ docker compose -f docker-compose.yml -f extensions/curator/curator-compose.yml up ``` This sample setup demonstrates how to run `curator` every minute using `cron`. diff --git a/extensions/curator/curator-compose.yml b/extensions/curator/curator-compose.yml index 1a4bb17..78734c5 100644 --- a/extensions/curator/curator-compose.yml +++ b/extensions/curator/curator-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: curator: build: diff --git a/extensions/enterprise-search/README.md b/extensions/enterprise-search/README.md index eeafc9f..e8ac573 100644 --- a/extensions/enterprise-search/README.md +++ b/extensions/enterprise-search/README.md @@ -70,7 +70,7 @@ To include Enterprise Search in the stack, run Docker Compose from the root of t line argument referencing the `enterprise-search-compose.yml` file: ```console -$ docker-compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml up +$ docker compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml up ``` Allow a few minutes for the stack to start, then open your web browser at the address to see the @@ -120,7 +120,7 @@ enterprise-search: Any change to the Enterprise Search configuration requires a restart of the Enterprise Search container: ```console -$ docker-compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml restart enterprise-search +$ docker compose -f docker-compose.yml -f extensions/enterprise-search/enterprise-search-compose.yml restart enterprise-search ``` Please refer to the following documentation page for more details about how to configure Enterprise Search inside a diff --git a/extensions/enterprise-search/enterprise-search-compose.yml b/extensions/enterprise-search/enterprise-search-compose.yml index 585dda9..84a0011 100644 --- a/extensions/enterprise-search/enterprise-search-compose.yml +++ b/extensions/enterprise-search/enterprise-search-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: enterprise-search: build: diff --git a/extensions/filebeat/README.md b/extensions/filebeat/README.md index f2bfd20..b1fcb09 100644 --- a/extensions/filebeat/README.md +++ b/extensions/filebeat/README.md @@ -14,7 +14,7 @@ To include Filebeat in the stack, run Docker Compose from the root of the reposi argument referencing the `filebeat-compose.yml` file: ```console -$ docker-compose -f docker-compose.yml -f extensions/filebeat/filebeat-compose.yml up +$ docker compose -f docker-compose.yml -f extensions/filebeat/filebeat-compose.yml up ``` ## Configuring Filebeat @@ -25,7 +25,7 @@ the help of the [Configuration reference][filebeat-config]. Any change to the Filebeat configuration requires a restart of the Filebeat container: ```console -$ docker-compose -f docker-compose.yml -f extensions/filebeat/filebeat-compose.yml restart filebeat +$ docker compose -f docker-compose.yml -f extensions/filebeat/filebeat-compose.yml restart filebeat ``` Please refer to the following documentation page for more details about how to configure Filebeat inside a Docker diff --git a/extensions/filebeat/filebeat-compose.yml b/extensions/filebeat/filebeat-compose.yml index 5c5960e..595a7d4 100644 --- a/extensions/filebeat/filebeat-compose.yml +++ b/extensions/filebeat/filebeat-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: filebeat: build: diff --git a/extensions/fleet/README.md b/extensions/fleet/README.md index fd6f761..bd8efde 100644 --- a/extensions/fleet/README.md +++ b/extensions/fleet/README.md @@ -21,7 +21,7 @@ To include Fleet Server in the stack, run Docker Compose from the root of the re argument referencing the `fleet-compose.yml` file: ```console -$ docker-compose -f docker-compose.yml -f extensions/fleet/fleet-compose.yml up +$ docker compose -f docker-compose.yml -f extensions/fleet/fleet-compose.yml up ``` ## Configuring Fleet Server diff --git a/extensions/fleet/agent-apmserver-compose.yml b/extensions/fleet/agent-apmserver-compose.yml index 06e201a..3becc09 100644 --- a/extensions/fleet/agent-apmserver-compose.yml +++ b/extensions/fleet/agent-apmserver-compose.yml @@ -1,10 +1,8 @@ -version: '3.7' - # Example of Fleet-enrolled Elastic Agent pre-configured with an agent policy # for running the APM Server integration (see kibana.yml). # # Run with -# docker-compose \ +# docker compose \ # -f docker-compose.yml \ # -f extensions/fleet/fleet-compose.yml \ # -f extensions/fleet/agent-apmserver-compose.yml \ diff --git a/extensions/fleet/fleet-compose.yml b/extensions/fleet/fleet-compose.yml index cb16c3d..a81d33b 100644 --- a/extensions/fleet/fleet-compose.yml +++ b/extensions/fleet/fleet-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: fleet-server: build: diff --git a/extensions/heartbeat/README.md b/extensions/heartbeat/README.md index 82c938f..64a761b 100644 --- a/extensions/heartbeat/README.md +++ b/extensions/heartbeat/README.md @@ -13,7 +13,7 @@ To include Heartbeat in the stack, run Docker Compose from the root of the repos argument referencing the `heartbeat-compose.yml` file: ```console -$ docker-compose -f docker-compose.yml -f extensions/heartbeat/heartbeat-compose.yml up +$ docker compose -f docker-compose.yml -f extensions/heartbeat/heartbeat-compose.yml up ``` ## Configuring Heartbeat @@ -24,7 +24,7 @@ with the help of the [Configuration reference][heartbeat-config]. Any change to the Heartbeat configuration requires a restart of the Heartbeat container: ```console -$ docker-compose -f docker-compose.yml -f extensions/heartbeat/heartbeat-compose.yml restart heartbeat +$ docker compose -f docker-compose.yml -f extensions/heartbeat/heartbeat-compose.yml restart heartbeat ``` Please refer to the following documentation page for more details about how to configure Heartbeat inside a diff --git a/extensions/heartbeat/heartbeat-compose.yml b/extensions/heartbeat/heartbeat-compose.yml index 47e0708..103d0df 100644 --- a/extensions/heartbeat/heartbeat-compose.yml +++ b/extensions/heartbeat/heartbeat-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: heartbeat: build: diff --git a/extensions/metricbeat/README.md b/extensions/metricbeat/README.md index 1da1eaa..2d042ba 100644 --- a/extensions/metricbeat/README.md +++ b/extensions/metricbeat/README.md @@ -14,7 +14,7 @@ To include Metricbeat in the stack, run Docker Compose from the root of the repo argument referencing the `metricbeat-compose.yml` file: ```console -$ docker-compose -f docker-compose.yml -f extensions/metricbeat/metricbeat-compose.yml up +$ docker compose -f docker-compose.yml -f extensions/metricbeat/metricbeat-compose.yml up ``` ## Configuring Metricbeat @@ -25,7 +25,7 @@ with the help of the [Configuration reference][metricbeat-config]. Any change to the Metricbeat configuration requires a restart of the Metricbeat container: ```console -$ docker-compose -f docker-compose.yml -f extensions/metricbeat/metricbeat-compose.yml restart metricbeat +$ docker compose -f docker-compose.yml -f extensions/metricbeat/metricbeat-compose.yml restart metricbeat ``` Please refer to the following documentation page for more details about how to configure Metricbeat inside a diff --git a/extensions/metricbeat/metricbeat-compose.yml b/extensions/metricbeat/metricbeat-compose.yml index 5b37a66..e7aa67f 100644 --- a/extensions/metricbeat/metricbeat-compose.yml +++ b/extensions/metricbeat/metricbeat-compose.yml @@ -1,5 +1,3 @@ -version: '3.7' - services: metricbeat: build: