dex4er / nss-docker

NSS module for finding Docker containers
GNU Lesser General Public License v2.1
42 stars 14 forks source link

Does not work OOTB with Docker Engine 25 anymore #14

Open moschlar opened 9 months ago

moschlar commented 9 months ago

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1061288

Docker Engine v25 (not yet natively packaged as docker.io, I know - but docker-ce from their repo is) deprecates legacy API versions: https://docs.docker.com/engine/deprecated/#deprecate-legacy-api-versions

This affects libnss-docker, because it has API version 1.21 (set at configure time).

A workaround until Docker Engine v26 would be to set DOCKER_MIN_API_VERSION=1.21 for the Docker Daemon, but after that, a minimum of 1.24 is required.

petski commented 9 months ago

You can simulate libnss-docker by doing this:

$ curl --silent --unix-socket /var/run/docker.sock 'http://foo/v1.21/containers/my_app/json'
client version 1.21 is too old. Minimum supported API version is 1.24, please upgrade your client to a newer version

This is what Docker Engine 25 will return to you. In earlier versions, you'll see the JSON output that libnss-docker "parses" to get it's information.

To work around the fact that API version 1.21 isn't available in Docker Engine 25, and let libnss-docker use another version of the API to get it's information, you can build nss-docker like so:

./configure --with-docker-api-version=1.40

In this example I picked version 1.40 as it's supported in Docker Engine 19.03, and further.