Docker-py: the client and server do not have the same version (client: 1.16, server: 1.15) ")

docker-py 0.7.0 gives me the following error regarding local installation of Docker Docker 1.3.2 and docker 0.7.0. The host launches CentOS 6.6. How can this be fixed?

xxxx@dev1 myproject]$ bin/python d.py Traceback (most recent call last): File "d.py", line 3, in <module> c.create_container(image='zopyx/xmldirector-plone') File "/home/xxxx/sandboxes/myproject/lib/python2.7/site-packages/docker/client.py", line 546, in create_container return self.create_container_from_config(config, name) File "/home/xxxx/sandboxes/myproject/lib/python2.7/site-packages/docker/client.py", line 554, in create_container_from_config return self._result(res, True) File "/home/xxxx/sandboxes/myproject/lib/python2.7/site-packages/docker/client.py", line 98, in _result self._raise_for_status(response) File "/home/xxxx/sandboxes/myproject/lib/python2.7/site-packages/docker/client.py", line 94, in _raise_for_status raise errors.APIError(e, response, explanation=explanation) docker.errors.APIError: 404 Client Error: Not Found ("client and server don't have same version (client : 1.16, server: 1.15)") >>docker --version Docker version 1.3.2, build 39fa2fa/1.3.2 >>docker version Client version: 1.3.2 Client API version: 1.15 Go version (client): go1.3.3 Git commit (client): 39fa2fa/1.3.2 OS/Arch (client): linux/amd64 Server version: 1.3.2 Server API version: 1.15 Go version (server): go1.3.3 Git commit (server): 39fa2fa/1.3.2 
+5
source share
3 answers

got the same issue yesterday. Force install docker-py = 0.6.0. If you already have 0.7.0 installed, you need to clear the cache pip, otherwise pip will install 0.7.0 from your cache.

Cheers, watts

+2
source

This is not a mistake, and docker-ru is trying to use the latest available docker api. If you have the latest docker, everything is fine, if you just do not need to transfer the "version" to the "Client".

https://github.com/docker/docker-py/blob/0.7.0/docs/api.md

+1
source

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') 
+1
source

Source: https://habr.com/ru/post/1210217/


All Articles