简体   繁体   中英

Docker error: client and server don't have same version

Since I just updated Docker to 1.1.0 I get:

Error response from daemon: client and server don't have same version (client : 1.13, server: 1.12)

Do you know how to fix this?

I switched back to 1.0.1 and everything works again.

It looks like you need to upgrade the VM after installing boot2docker:

if you are upgrading from boot2docker 0.12 or later, you can update your existing virtual machine (after upgrading using the installer) using boot2docker stop && boot2docker download && boot2docker up - and you will not lose your existing data.

( https://github.com/boot2docker/osx-installer/releases/tag/v1.1.0 )

This can happen if you have updated Docker, but the service has not been restarted. You will then try to connect to the Docker daemon with the updated client, while the daemon (that was already running before the update) is still running the older version.

To fix this, restart the service:

sysV init:

service docker restart

systemd:

systemctl daemon-reload

systemctl restart docker

In case you use docker-machine to manage a local VirtualBox-based machines the solution is as simple as for boot2docker:

docker-machine upgrade MACHINE_NAME

It asks docker-machine to download the latest boot2docker.iso and place it as a new root filesystem in the upgraded VM.

By the way, the VirtualBox-backed docker machine has its root filesystem readonly. That mean it's not possible for any manual update survive the machine reboot. That was a surprise for me.

I had the latest version of boot2docker, docker and virtual box but was still receiving this message. It seems running brew upgrade boot2docker isn't the best idea. When running boot2docker upgrade , I was asked to set a bunch of environment variables and then it worked for me.

Boot2docker asked me to set these (see the last lines):

$ boot2docker upgrade
Latest release for boot2docker/boot2docker is v1.3.0
Downloading boot2docker ISO image...
Success: downloaded https://github.com/boot2docker/boot2docker/releases/download/v1.3.0/boot2docker.iso
    to /Users/.../.boot2docker/boot2docker.iso
Waiting for VM and Docker daemon to start...
.........oooooooooooooo
Started.
Writing /Users/.../.boot2docker/certs/boot2docker-vm/ca.pem
Writing /Users/.../.boot2docker/certs/boot2docker-vm/cert.pem
Writing /Users/.../.boot2docker/certs/boot2docker-vm/key.pem

To connect the Docker client to the Docker daemon, please set:
    export DOCKER_HOST=tcp://192.168.59.103:2376
    export DOCKER_CERT_PATH=/Users/.../.boot2docker/certs/boot2docker-vm
    export DOCKER_TLS_VERIFY=1

It's possible to cut and paste those three lines in one go, into your terminal.

To check they are correct:

$ env

I was trying to query a Docker server with a more recent client:

  • Server API version: 1.21
  • Client API version 1.22

The solution for me was to just:

export DOCKER_API_VERSION=1.21

Reference: https://docs.docker.com/engine/reference/commandline/cli/

The correct answer here is very old (Docker have renamed boot2docker to Docker Machine and added some more functionality to it) .

Anyway I faced the same problem and took me about 3 days to fix :(

Here's the solution

1) find the location of the boot2docker.iso

sudo find ~/ -name 'boot2docker.iso'

2) delete the boot2docker.iso file, after taking a backup of it

/Users/{user}/.docker/machine/cache/boot2docker.iso

3) delete your docker vm

docker-machine rm {default}

this should delete that one as well:

/Users/{user}/.docker/machine/machines/default/boot2docker.iso

4) create new docker vm

docker-machine create --driver virtualbox default

this will download a new boot2docker.iso first and then use it to create your vm.

Now this should fix it :)

BUT

If you get any error here like:

Running pre-create checks...
(mega-docker) No default Boot2Docker ISO found locally, downloading the latest release...
Error with pre-create check: "Get https://api.github.com/repos/boot2docker/boot2docker/releases/latest: dial tcp: lookup api.github.com on 192.168.0.1:53: read udp 192.168.0.103:53947->192.168.0.1:53: i/o timeout"

try to download the boot2docker.iso file manually by going to https://api.github.com/repos/boot2docker/boot2docker/releases/latest then clicking on the html_url and finally choosing to download the file.

once you get the file go and place it manually in /Users/{user}/.docker/machine/cache/

finally re-run this command docker-machine create --driver virtualbox default

对我来说唯一有用的就是杀死进程并以“sudo service docker start”启动它。

对我来说唯一有用的就是从VirtualBox中删除boot2docker映像,然后完全删除~/.boot2docker文件夹,最后再次运行boot2docker init

boot2docker delete

boot2docker init

worked for me. stop/start the deamon before and after that of course.

This worked for me: It just shuts the vm down, deletes & recreates it and starts it up again. It re-runs shellinit so your ENV variables get set with the correct IP address when it comes back up.

$ boot2docker poweroff && \
    boot2docker delete && \
    boot2docker init && \
    boot2docker up
$ eval `boot2docker shellinit`

I find the version in brew is outdated compared to the one on the docker.io website. Therefore I think the best way is go to the website and download the install file.

I had the latest version of boot2docker(v1.7.1) and got the client server mismatch error. Then I just ran boot2docker upgrade and it solved the problem.

Ansible Answer:

If you came there by Ansible and not boot2docker, here is the solution: Use the docker_api_version: auto argument

- name: Mongo data container
  docker:
    docker_api_version: auto
    name: mongo-primary-dc
    image: debian:wheezy
    state: present
    volumes:
    - /data

I guess the reason is that the docker-py module used by Ansible is often not at the same version as the Ubuntu apt-get repository.

My solution was to do a Close > Power Off on the docker VM in VirtualBox, and then restart Kitematic. This fixed it for me.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM