Skip to content

deprecate old API versions (1.23 and lower)#4796

Merged
thaJeztah merged 1 commit intodocker:masterfrom
thaJeztah:deprecate_old_api_versions
Jan 16, 2024
Merged

deprecate old API versions (1.23 and lower)#4796
thaJeztah merged 1 commit intodocker:masterfrom
thaJeztah:deprecate_old_api_versions

Conversation

@thaJeztah
Copy link
Member

The Docker Daemon provides a versioned API for backward compatibility with old clients. When a client connects, it can perform API-version negotiation to select the most recent API version supported by the daemon (downgrading to and older version of the API when necessary). API version negotiation was introduced in Docker v1.12.0 (API 1.24), and clients before that used a fixed API version.

Docker Engine up until v25.0 provide support for all API versions included in stable releases for a given platform. For Linux daemons, the oldest supported API version is 1.12 (corresponding with Docker Engine v1.0.0), whereas for Windows Daemons, the oldest supported API version is 1.24 (corresponding with Docker Engine v1.12.0).

Support for legacy API versions (providing old API versions on current versions of the Docker Engine) is primarily intended to provide compatibility with recent, but still supported versions of the client, which is a common scenario (the Docker Daemon may be updated to the latest release, but not all clients may be up-to-date or vice versa). Support for API versions before that (API versions provided by EOL versions of the Docker Daemon) is provided on a "best effort" base.

Use of old API versions is very rare, and support for legacy API versions involves significant complexity (Docker 1.0.0 was released 10 Years ago). Because of this, we'll start deprecating support for legacy API versions.

Docker Engine v25.0 by default disables API version older than 1.24 (aligning the minimum supported API version between Linux and Windows daemons). When connecting with a client that uses an API version version older than 1.24, the daemon returns an error. The following example configures the docker CLI to use API version 1.23, which produces an error:

DOCKER_API_VERSION=1.23 docker version
Error response from daemon: client version 1.23 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

An environment variable (DOCKER_MIN_API_VERSION) is introduced that allows re-enabling older API versions in the daemon. This environment-variable must be set in the daemon's environment (for example, through a systemd override file), and the specified API version must be supported by the daemon (1.12 or higher on Linux, or 1.24 or higher on Windows).

Support for API versions lower than 1.24 will be permanently removed in Docker Engine v26, and the minimum supported API version will be incrementally raised in releases following that.

We do not recommend depending on the DOCKER_MIN_API_VERSION environment variable other than for exceptional cases where it's not possible to update old clients, and those clients must be supported.

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

@codecov-commenter
Copy link

Codecov Report

Merging #4796 (9791b23) into master (a18dad3) will not change coverage.
The diff coverage is n/a.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4796   +/-   ##
=======================================
  Coverage   59.61%   59.61%           
=======================================
  Files         288      288           
  Lines       24785    24785           
=======================================
  Hits        14775    14775           
  Misses       9122     9122           
  Partials      888      888           

Error response from daemon: client version 1.23 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version
```

An environment variable (`DOCKER_MIN_API_VERSION`) is introduced that allows
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I decided to not (yet?) document this env-var in the dockerd reference; https://docs.docker.com/engine/reference/commandline/dockerd/#environment-variables

My motivation;

  • This is not a recommended env-var
  • We could add a separate table "for debugging purposes" (or similar) to better separate "ok to use" and "not recommended, other than exceptional cases" env-vars
  • ☝️ while looking at that, I also discovered various other undocumented or (almost not documented) env-vars, such as DEBUG, DOCKER_WINDOWSFILTER_NOREEXEC, DOCKER_CLI_PLUGIN_USE_DIAL_STDIO, ROOTLESSKIT_STATE_DIR), some of which are for the "daeemon", some for the "cli", and some are intentionally un-documented (intended for use in CI, e.g.), so we need to collect all of those, and decide whether to document them, and "how".

Copy link
Contributor

@dvdksn dvdksn Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh. We really need to do an inventory of all env vars and ensure they are properly and consistently prefixed with a namespace e.g. DOCKER_.

ROOTLESSKIT_STATE_DIR
vs
DOCKERD_ROOTLESS_ROOTLESSKIT_NET

(nothing wrong with DOCKER_MIN_API_VERSION, this is just a drive-by complaint)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the ROOTLESSKIT one may be because the library we're using defined it, but yes; leaning toward documenting all of them even if they should NOT be used (but doing so gives us a clear way to tell users "don't use this!")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically ROOTLESSKIT is because it's a "third party" (read: re-used in multiple places) codebase being configured, and the uniformity makes sense (especially when you consider it is an external binary that multiple packages may re-use).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, and there will be more env-vars like that (only think of OTEL, or AWS env-vars consumed by their SDK / logging-drivers, etc).

This was just a 2-second grep for os.GetEnv in our code

introduced in Docker v1.12.0 (API 1.24), and clients before that used a fixed
API version.

Docker Engine up until v25.0 provide support for all [API versions](https://docs.docker.com/engine/api/#api-version-matrix)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Docker Engine up until v25.0 provide support for all [API versions](https://docs.docker.com/engine/api/#api-version-matrix)
Docker Engine versions through v25.0 provide support for all [API versions](https://docs.docker.com/engine/api/#api-version-matrix)

but still supported versions of the client, which is a common scenario (the Docker
Daemon may be updated to the latest release, but not all clients may be up-to-date
or vice versa). Support for API versions before that (API versions provided by EOL
versions of the Docker Daemon) is provided on a "best effort" base.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
versions of the Docker Daemon) is provided on a "best effort" base.
versions of the Docker Daemon) is provided on a "best effort" basis.

versions of the Docker Daemon) is provided on a "best effort" base.

Use of old API versions is very rare, and support for legacy API versions
involves significant complexity (Docker 1.0.0 was released 10 Years ago).
Copy link
Member

@neersighted neersighted Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
involves significant complexity (Docker 1.0.0 was released 10 Years ago).
involves significant complexity (Docker 1.0.0 having been released 10 years ago).

```

An environment variable (`DOCKER_MIN_API_VERSION`) is introduced that allows
re-enabling older API versions in the daemon. This environment-variable must
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
re-enabling older API versions in the daemon. This environment-variable must
re-enabling older API versions in the daemon. This environment variable must

**Deprecated in Release: v25.0**
**Target For Removal In Release: v26.0**

The Docker Daemon provides a versioned API for backward compatibility with old
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The Docker Daemon provides a versioned API for backward compatibility with old
The Docker daemon provides a versioned API for backward compatibility with old

**Target For Removal In Release: v26.0**

The Docker Daemon provides a versioned API for backward compatibility with old
clients. When a client connects, it can perform API-version negotiation to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
clients. When a client connects, it can perform API-version negotiation to
clients. Docker clients can perform API-version negotiation to

API version.

Docker Engine up until v25.0 provide support for all [API versions](https://docs.docker.com/engine/api/#api-version-matrix)
included in stable releases for a given platform. For Linux daemons, the oldest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.docker.com/contribute/style/recommended-words/#earlier

Suggested change
included in stable releases for a given platform. For Linux daemons, the oldest
included in stable releases for a given platform. For Linux daemons, the earliest

Docker Engine up until v25.0 provide support for all [API versions](https://docs.docker.com/engine/api/#api-version-matrix)
included in stable releases for a given platform. For Linux daemons, the oldest
supported API version is 1.12 (corresponding with Docker Engine v1.0.0), whereas
for Windows Daemons, the oldest supported API version is 1.24 (corresponding
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for Windows Daemons, the oldest supported API version is 1.24 (corresponding
for Windows Daemons, the earliest supported API version is 1.24 (corresponding

Support for legacy API versions (providing old API versions on current versions
of the Docker Engine) is primarily intended to provide compatibility with recent,
but still supported versions of the client, which is a common scenario (the Docker
Daemon may be updated to the latest release, but not all clients may be up-to-date
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Daemon may be updated to the latest release, but not all clients may be up-to-date
daemon may be updated to the latest release, but not all clients may be up-to-date

The Docker daemon provides a versioned API for backward compatibility with old
clients. Docker clients can perform API-version negotiation to select the most
recent API version supported by the daemon (downgrading to and older version of
the API when necessary). API version negotiation was introduced in Docker v1.12.0
(API 1.24), and clients before that used a fixed API version.

Docker Engine versions through v25.0 provide support for all [API versions](https://docs.docker.com/engine/api/#api-version-matrix)
included in stable releases for a given platform. For Docker daemons on Linux,
the earliest supported API version is 1.12 (corresponding with Docker Engine
v1.0.0), whereas for Docker daemons on Windows, the earliest supported API
version is 1.24 (corresponding with Docker Engine v1.12.0).

Support for legacy API versions (providing old API versions on current versions
of the Docker Engine) is primarily intended to provide compatibility with recent,
but still supported versions of the client, which is a common scenario (the Docker
daemon may be updated to the latest release, but not all clients may be up-to-date
or vice versa). Support for API versions before that (API versions provided by
EOL versions of the Docker Daemon) is provided on a "best effort" basis.

Use of old API versions is very rare, and support for legacy API versions
involves significant complexity (Docker 1.0.0 having been released 10 years ago).
Because of this, we'll start deprecating support for legacy API versions.

Docker Engine v25.0 by default disables API version older than 1.24 (aligning
the minimum supported API version between Linux and Windows daemons). When
connecting with a client that uses an API version version older than 1.24,
the daemon returns an error. The following example configures the docker
CLI to use API version 1.23, which produces an error:

    DOCKER_API_VERSION=1.23 docker version
    Error response from daemon: client version 1.23 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

An environment variable (`DOCKER_MIN_API_VERSION`) is introduced that allows
re-enabling older API versions in the daemon. This environment variable must
be set in the daemon's environment (for example, through a [systemd override
file](https://docs.docker.com/config/daemon/systemd/)), and the specified
API version must be supported by the daemon (`1.12` or higher on Linux, or
`1.24` or higher on Windows).

Support for API versions lower than `1.24` will be permanently removed in Docker
Engine v26, and the minimum supported API version will be incrementally raised
in releases following that.

We do not recommend depending on the `DOCKER_MIN_API_VERSION` environment
variable other than for exceptional cases where it's not possible to update
old clients, and those clients must be supported.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah force-pushed the deprecate_old_api_versions branch from 9791b23 to d2efc5b Compare January 16, 2024 17:16
@thaJeztah
Copy link
Member Author

@dvdksn @neersighted I THINK I addressed your comments, but take a good look to see if I did 🤗

@thaJeztah
Copy link
Member Author

Thanks! I'll bring this one in, but happy to touch-up things in a follow up where we see a need 👍

@thaJeztah thaJeztah merged commit 5fde1f2 into docker:master Jan 16, 2024
@thaJeztah thaJeztah deleted the deprecate_old_api_versions branch January 16, 2024 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants