解决boot2docker - docker Error: client and server don't have same version

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wxb880114/article/details/84138663

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.

docker boot2docker docker-machine 
 | 
  this question
 edited Mar 8 '16 at 17:45 Brice 14.3k 1 44 64 asked Jul 5 '14 at 12:45 soenke 503 1 4 7      I have the same problem, using boot2docker. Is that also your case? –  sigmus Jul 5 '14 at 15:25 2   yes I'm also using boot2docker. after uninstalling docker and installing it again (not 'reinstall') its working again. brew uninstall docker && brew install docker –  soenke Jul 6 '14 at 11:50 4   Maybe you should edit the title / question to make it clear it is a boot2docker issue (for future reference). –  sigmus Jul 6 '14 at 15:56      Shameless plug: a friend and I put together a tool called Docker Version Manager to help with this in the short term. –  Kyle Kelley Sep 26 '15 at 19:29



 | 

13 Answers
13

解决方法

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 answer
 answered Jul 6 '14 at 11:39 Abel Muiño 5,251 2 16 13 3   also brew uninstall docker && brew install docker did the job –  soenke Jul 6 '14 at 11:53 5   You no longer need to use the brew version of the docker command line tool. Boot2Docker provides the right version. –  Abel Muiño Jul 6 '14 at 11:55      boot2docker download <-- solved it for me –  Mampersat Jun 23 '15 at 13:21 1   I ran into this certificate issue, too. I ran boot2docker delete, then boot2docker init and it started working. –  Dean Wampler Jun 30 '15 at 17:11 1   A friend and I put together a tool called Docker Version Manager to help with this in the short term. –  Kyle Kelley Sep 26 '15 at 19:23  |  show more comment

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


 | 
  this answer
 edited Nov 10 '14 at 8:58 answered Oct 26 '14 at 22:37 BakaKuna 421 3 8 1   Forsystemd it is recommended to do systemctl daemon-reload before systemctl restart docker –  baldrs Nov 3 '14 at 10:15      Seems like the simplest answer is the best answer :) – Dariss Aug 26 '15 at 16:36



 | 

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.


 | 
  this answer
 edited Aug 11 '15 at 8:13 answered May 3 '15 at 14:44 Peter Leonov 420 3 13



 | 

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


 | 
  this answer
 edited Mar 20 '15 at 1:05 answered Oct 31 '14 at 2:32 Rimian 15.6k 6 74 83 2   This command should do the same: $(boot2docker shellinit) –  Somatik Nov 13 '14 at 14:25



 | 

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/


 | 
  this answer
 answered Mar 31 '16 at 13:26 Marcello Romani 710 7 14 1   I think this answer should be the 解决方法 one. –  Vitaly Isaev Jul 28 '16 at 8:23



 | 

The only thing that worked for me was killing the process and starting it with "sudo service docker start".


 | 
  this answer
 answered Jan 20 '15 at 3:41 pawl 172 1 11



 | 

The only thing the worked for me was removing the boot2docker image from VirtualBox then completely deleting ~/.boot2docker folder, and finally running boot2docker initagain.


 | 
  this answer
 answered Apr 19 '15 at 20:21 dkinzer 13.6k 7 41 69



 | 

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


 | 
  this answer
 answered Mar 30 '16 at 3:08 Mahmoud Zalt 5,239 33 38



 | 

boot2docker delete

boot2docker init

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


 | 
  this answer
 answered May 27 '15 at 9:53 apflieger 11 1



 | 

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`


 | 
  this answer
 edited Jul 10 '15 at 21:09 answered Jul 10 '15 at 21:01 0xADADA 21 4



 | 

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


 | 
  this answer
 answered Nov 4 '14 at 8:30 Tommy 1,549 1 17 19



 | 

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.


 | 
  this answer
 answered Aug 10 '15 at 14:58 Samitha 1



 | 

Ansible Answers
:

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.


 | 
  this answer
 answered Jan 22 '16 at 11:35 Nicolas Zozol 3,237 1 26 49



 | 

猜你喜欢

转载自blog.csdn.net/wxb880114/article/details/84138663