Skip to content

Commit 28c8e4b

Browse files
authored
Remove support for Docker Compose v1 (#1785)
elastic-package is likely not working with Docker Compose v1 at this point, and it is discontinued since last year. Completely remove support for it.
1 parent ed1fab3 commit 28c8e4b

File tree

9 files changed

+5
-27
lines changed

9 files changed

+5
-27
lines changed

docs/howto/system_benchmarking.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ To use environment variables within the Terraform service deployer a `env.yml` f
156156
The file should be structured like this:
157157

158158
```yaml
159-
version: '2.3'
160159
services:
161160
terraform:
162161
environment:

docs/howto/system_testing.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ the log files from your package's integration service must be written to a volum
7676
the following definition in it's integration service's `docker-compose.yml` file.
7777

7878
```yaml
79-
version: '2.3'
8079
services:
8180
apache:
8281
# Other properties such as build, ports, etc.
@@ -95,7 +94,6 @@ For example docker images for MySQL include a volume for the data directory
9594
tests are executed, a volume can be added to the `docker-compose.yml`:
9695

9796
```yaml
98-
version: '2.3'
9997
services:
10098
mysql:
10199
# Other properties such as build, ports, etc.
@@ -118,7 +116,6 @@ This is useful if you need different capabilities than the provided by the
118116

119117
`custom-agent.yml`
120118
```yaml
121-
version: '2.3'
122119
services:
123120
docker-custom-agent:
124121
pid: host
@@ -131,7 +128,6 @@ services:
131128
This will result in an agent configuration such as:
132129

133130
```yaml
134-
version: '2.3'
135131
services:
136132
docker-custom-agent:
137133
hostname: docker-custom-agent
@@ -196,7 +192,6 @@ RUN apt-get update && apt-get -y install \
196192
```
197193
An example for `custom-agent.yml` in multi-service setup is as below
198194
```yaml
199-
version: '2.3'
200195
services:
201196
docker-custom-agent:
202197
build:
@@ -328,7 +323,6 @@ To use environment variables within the Terraform service deployer a `env.yml` f
328323
The file should be structured like this:
329324

330325
```yaml
331-
version: '2.3'
332326
services:
333327
terraform:
334328
environment:

internal/agentdeployer/_static/docker-agent-base.yml.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: "2.3"
21
services:
32
elastic-agent:
43
hostname: ${AGENT_HOSTNAME}

internal/compose/compose.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ type Project struct {
4747
name string
4848
composeFilePaths []string
4949

50-
dockerComposeV1 bool
5150
dockerComposeStandalone bool
5251
disableANSI bool
5352
disablePullProgressInformation bool
@@ -199,20 +198,15 @@ func NewProject(name string, paths ...string) (*Project, error) {
199198
// Passing a nil context here because we are on initialization.
200199
ver, err := c.dockerComposeVersion(context.Background())
201200
if err != nil {
202-
logger.Errorf("Unable to determine Docker Compose version: %v. Defaulting to 1.x", err)
203-
c.dockerComposeV1 = true
204-
return &c, nil
201+
return nil, fmt.Errorf("unable to determine Docker Compose version: %w", err)
205202
}
206-
207-
versionMessage := fmt.Sprintf("Determined Docker Compose version: %v", ver)
208-
if ver.Major() == 1 {
209-
versionMessage = fmt.Sprintf("%s, the tool will use Compose V1", versionMessage)
210-
c.dockerComposeV1 = true
203+
if ver.Major() < 2 {
204+
return nil, fmt.Errorf("required Docker Compose v2, found %s", ver.String())
211205
}
212-
logger.Debug(versionMessage)
206+
logger.Debugf("Determined Docker Compose version: %v", ver)
213207

214208
v, ok = os.LookupEnv(DisableVerboseOutputComposeEnv)
215-
if !c.dockerComposeV1 && ok && strings.ToLower(v) != "false" {
209+
if ok && strings.ToLower(v) != "false" {
216210
if c.composeVersion.LessThan(semver.MustParse("2.19.0")) {
217211
c.disableANSI = true
218212
} else {
@@ -543,8 +537,5 @@ func (p *Project) dockerComposeVersion(ctx context.Context) (*semver.Version, er
543537

544538
// ContainerName method the container name for the service.
545539
func (p *Project) ContainerName(serviceName string) string {
546-
if p.dockerComposeV1 {
547-
return fmt.Sprintf("%s_%s_1", p.name, serviceName)
548-
}
549540
return fmt.Sprintf("%s-%s-1", p.name, serviceName)
550541
}

internal/servicedeployer/_static/docker-custom-agent-base.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: "2.3"
21
services:
32
docker-custom-agent:
43
image: "${ELASTIC_AGENT_IMAGE_REF}"

internal/servicedeployer/_static/terraform_deployer.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '2.3'
21
services:
32
terraform:
43
build: .

internal/stack/_static/docker-compose-stack.yml.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{{ $username := fact "username" }}
22
{{ $password := fact "password" }}
33
{{ $apm_enabled := fact "apm_enabled" }}
4-
version: '2.4'
54
services:
65
elasticsearch:
76
image: "${ELASTICSEARCH_IMAGE_REF}"

internal/stack/_static/serverless-docker-compose.yml.tmpl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: '2.4'
21
services:
32
elastic-agent:
43
image: "{{ fact "agent_image" }}"

test/packages/false_positives/cisco_asa/_dev/deploy/docker/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
version: "2.3"
21
services:
32
cisco-logfile:
43
image: alpine

0 commit comments

Comments
 (0)