Skip to content

Commit 2e6eb57

Browse files
committed
Bump min/default docker API version to 1.24
1 parent f3208a9 commit 2e6eb57

12 files changed

+86
-131
lines changed

agent/app/agent.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -1098,25 +1098,25 @@ func (agent *ecsAgent) startACSSession(
10981098
}
10991099

11001100
// validateRequiredVersion validates docker version.
1101-
// Minimum docker version supported is 1.9.0, maps to api version 1.21
1102-
// see https://docs.docker.com/develop/sdk/#api-version-matrix
1101+
// Minimum docker version supported is 1.12.0, maps to api version 1.24
1102+
// see https://docs.docker.com/engine/release-notes/prior-releases/. Docker API
1103+
// versions prior to 1.24 are deprecated as of Jan 2024. See
1104+
// https://docs.docker.com/engine/api/#deprecated-api-versions
11031105
func (agent *ecsAgent) verifyRequiredDockerVersion() (int, bool) {
11041106
supportedVersions := agent.dockerClient.SupportedVersions()
11051107
if len(supportedVersions) == 0 {
11061108
seelog.Critical("Could not get supported docker versions.")
11071109
return exitcodes.ExitError, false
11081110
}
11091111

1110-
// if api version 1.21 is supported, it means docker version is at least 1.9.0
11111112
for _, version := range supportedVersions {
1112-
if version == dockerclient.Version_1_21 {
1113+
if version == dockerclient.MinDockerAPIVersion {
11131114
return -1, true
11141115
}
11151116
}
11161117

1117-
// api 1.21 is not supported, docker version is older than 1.9.0
11181118
seelog.Criticalf("Required minimum docker API verion %s is not supported",
1119-
dockerclient.Version_1_21)
1119+
dockerclient.MinDockerAPIVersion)
11201120
return exitcodes.ExitTerminal, false
11211121
}
11221122

agent/app/agent_capability.go

+12-8
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,13 @@ func (agent *ecsAgent) capabilities() ([]*ecs.Attribute, error) {
206206
}
207207

208208
supportedVersions := make(map[dockerclient.DockerVersion]bool)
209-
// Determine API versions to report as supported. Supported versions are also used for capability-enablement, except
210-
// logging drivers.
211-
for _, version := range agent.dockerClient.SupportedVersions() {
209+
// Determine API versions to report as supported via com.amazonaws.ecs.capability.docker-remote-api.X.XX capabilities
210+
// We advertise all known versions here rather than "supported" versions. The reason for this is that ECS backend
211+
// adds required capabilities to some features at the minimum supported version. If this is less than our Minimum
212+
// supported version (currently 1.24), then the capability will not match.
213+
// In other words, here we advertise supporting docker api versions that this agent may not actually support, for the
214+
// sake of task definition required attributes.
215+
for _, version := range dockerclient.GetKnownAPIVersions() {
212216
capabilities = appendNameOnlyAttribute(capabilities, capabilityPrefix+"docker-remote-api."+string(version))
213217
supportedVersions[version] = true
214218
}
@@ -311,12 +315,12 @@ func (agent *ecsAgent) capabilities() ([]*ecs.Attribute, error) {
311315

312316
func (agent *ecsAgent) appendDockerDependentCapabilities(capabilities []*ecs.Attribute,
313317
supportedVersions map[dockerclient.DockerVersion]bool) []*ecs.Attribute {
314-
if _, ok := supportedVersions[dockerclient.Version_1_19]; ok {
318+
if _, ok := supportedVersions[dockerclient.MinDockerAPIVersion]; ok {
315319
capabilities = appendNameOnlyAttribute(capabilities, capabilityPrefix+"ecr-auth")
316320
capabilities = appendNameOnlyAttribute(capabilities, attributePrefix+"execution-role-ecr-pull")
317321
}
318322

319-
if _, ok := supportedVersions[dockerclient.Version_1_24]; ok && !agent.cfg.DisableDockerHealthCheck.Enabled() {
323+
if _, ok := supportedVersions[dockerclient.MinDockerAPIVersion]; ok && !agent.cfg.DisableDockerHealthCheck.Enabled() {
320324
// Docker health check was added in API 1.24
321325
capabilities = appendNameOnlyAttribute(capabilities, attributePrefix+"container-health-check")
322326
}
@@ -361,7 +365,7 @@ func (agent *ecsAgent) appendTaskIamRoleCapabilities(capabilities []*ecs.Attribu
361365
// The "task-iam-role" capability is supported for docker v1.7.x onwards
362366
// Refer https://github.com/docker/docker/blob/master/docs/reference/api/docker_remote_api.md
363367
// to lookup the table of docker supportedVersions to API supportedVersions
364-
if _, ok := supportedVersions[dockerclient.Version_1_19]; ok {
368+
if _, ok := supportedVersions[dockerclient.MinDockerAPIVersion]; ok {
365369
capabilities = appendNameOnlyAttribute(capabilities, capabilityPrefix+capabilityTaskIAMRole)
366370
} else {
367371
seelog.Warn("Task IAM Role not enabled due to unsuppported Docker version")
@@ -370,7 +374,7 @@ func (agent *ecsAgent) appendTaskIamRoleCapabilities(capabilities []*ecs.Attribu
370374

371375
if agent.cfg.TaskIAMRoleEnabledForNetworkHost {
372376
// The "task-iam-role-network-host" capability is supported for docker v1.7.x onwards
373-
if _, ok := supportedVersions[dockerclient.Version_1_19]; ok {
377+
if _, ok := supportedVersions[dockerclient.MinDockerAPIVersion]; ok {
374378
capabilities = appendNameOnlyAttribute(capabilities, capabilityPrefix+capabilityTaskIAMRoleNetHost)
375379
} else {
376380
seelog.Warn("Task IAM Role for Host Network not enabled due to unsuppported Docker version")
@@ -381,7 +385,7 @@ func (agent *ecsAgent) appendTaskIamRoleCapabilities(capabilities []*ecs.Attribu
381385

382386
func (agent *ecsAgent) appendTaskCPUMemLimitCapabilities(capabilities []*ecs.Attribute, supportedVersions map[dockerclient.DockerVersion]bool) ([]*ecs.Attribute, error) {
383387
if agent.cfg.TaskCPUMemLimit.Enabled() {
384-
if _, ok := supportedVersions[dockerclient.Version_1_22]; ok {
388+
if _, ok := supportedVersions[dockerclient.MinDockerAPIVersion]; ok {
385389
capabilities = appendNameOnlyAttribute(capabilities, attributePrefix+capabilityTaskCPUMemLimit)
386390
} else if agent.cfg.TaskCPUMemLimit.Value == config.ExplicitlyEnabled {
387391
// explicitly enabled -- return an error because we cannot fulfil an explicit request

0 commit comments

Comments
 (0)