Solution if the client version is newer than the server version:
Suppose you want to connect to your docker, for example:
docker_client = Client(base_url='tcp://127.0.0.1:2376') # Alternatively: # docker_client = Client(base_url='unix://var/run/docker.sock')
If the client version is newer than the server version, this will result in an error message that resembles the following:
docker.errors.NotFound: 404 Client Error: Not Found ("client and server don't have same version (client : 1.22, server: 1.18)")
You can solve the problem by setting the version property of the docker.Client object (as suggested by @sredni). Given the above error, you need to change the line to:
docker_client = Client(base_url='tcp://127.0.0.1:2376', version='1.18')
source share