43

docker version prints:

Client version: 1.0.1
Client API version: 1.12
Go version (client): go1.2.1
Git commit (client): 990021a
Server version: 1.0.1
Server API version: 1.12
Go version (server): go1.2.1
Git commit (server): 990021a

docker-compose --version prints:

docker-compose 1.2.0

I installed docker with apt-get install docker.io and docker-compose with

curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

I use Ubuntu 14.04 x64.

Donovan
  • 816
  • 1
  • 10
  • 16

9 Answers9

52

Checkout the environment variable COMPOSE_API_VERSION.

I was getting ERROR: client and server don't have same version (client : 1.19, server: 1.18), then I did export COMPOSE_API_VERSION=1.18 and problem sovled!

Zulu
  • 8,765
  • 9
  • 49
  • 56
hba
  • 7,406
  • 10
  • 63
  • 105
16

This is an issue of docker API version used by docker-compose being higher than that that of docker daemon listening to serve.

Easiest way to fix is this to use an older version of docker-compose.

Here is my example but with different version mismatch:

$ docker-compose up

client and server don't have same version (client : 1.18, server: 1.17)

To fix it, I had to install a lower version of docker-compose(1.2 version instead of latest 1.3 version) using following command

curl -L https://github.com/docker/compose/releases/download/1.2.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose``

chmod +x /usr/local/bin/docker-compose`

You can find different version of docker-compose at https://github.com/docker/compose/releases

Based on your server version, you need to try different lower versioned docker-compose until one works.

ipmcc
  • 29,581
  • 5
  • 84
  • 147
Srini Koganti
  • 161
  • 1
  • 4
15

I think you just need to use a newer version of Docker. Presumably client version 1.14 is used internally in Compose.

Uninstall the apt-get version and follow the instructions on the Docker website to install Docker:

 wget -qO- https://get.docker.com/ | sh
Adrian Mouat
  • 44,585
  • 16
  • 110
  • 102
  • I did that and when I try to use it I get `-bash: /usr/local/bin/docker: No such file or directory` – Donovan Apr 19 '15 at 10:00
  • Did you remove the previous version? You may just need to log in and out or something. Anyway, that script should have installed the lxc-docker package. – Adrian Mouat Apr 19 '15 at 13:00
  • It does install it but I can't use it. I get that error. – Donovan Apr 20 '15 at 06:54
  • I'm not sure. My docker is at /usr/bin/docker. Maybe you need to reinstall compose as well. Anyway, this is a different problem. – Adrian Mouat Apr 20 '15 at 08:01
  • Reinstalling Docker worked for me, although your instructions did not (for me). Try the ones at https://docs.docker.com/linux/step_one/ - `curl -fsSL https://get.docker.com/ | sh` – Greg Apr 24 '16 at 00:42
4

I tried a lot of solution but when I used sudo apt-get upgrade docker-engine I see message that I have installed docker with different name as docker-ce . After I fixed with sudo apt-get upgrade docker-ce.

Anton
  • 41
  • 2
3

you can downgrade your docker-compose version,if you have installled your docker-compose by:

pip install docker-compose

you can uninstall it first by:

pip uninstall docker-compose

then,you can run:

pip install docker-compose==1.3.0

if you docker-compose up,still show the similar info,you can uninstall it(by pip uninstall docker-compose),and install a lower version docker-compose,such as:

pip install docker-compose==1.2.0

you can go on the loop, if still show the wrong info.

ps:the detail version number can be found in https://github.com/docker/compose/releases

2

Try restarting the docker service after upgrading Docker (sudo service docker restart).

I had a very similar issue, upgraded Docker, and kept running into the same error message until I restarted the service. (See https://serverfault.com/a/700707/295500.)

Flavien Volken
  • 19,196
  • 12
  • 100
  • 133
2

Since docker-compose 1.4 you can set the client API version, you don't have to downgrade the client or upgrade the server.

You do not have to set a specific API version either, you can set the environment variable COMPOSE_API_VERSION=auto to have it auto-detect the client version.

L. G.
  • 9,642
  • 7
  • 56
  • 78
2

I found uninstalling the version installed with apt-get and downloading directly from latest version on their download page via command line wget seemed to work..

  • I also had problems with the old version of docker provided in ubuntu/trusty repo. To install the newest for trusty see https://docs.docker.com/v17.09/engine/installation/linux/docker-ce/ubuntu/ . For newer OS' follow https://docs.docker.com/install/. – dr0i Apr 30 '19 at 14:49
0

I had the same problem on my Mac - some months ago I installed docker, boot2docker und docker-compose (formerly fig) via brew. After I played a while with docker, I left it for some reason as it was. Now new docker-toolbox and docker-machine come into play and I "just" wanted to use a preconfigured docker-file and say "up". I got the error above.

I tried all things i found on the net - also the downgrade-option (which didn't feel right for me). The thing finally worked, was just to install new docker-toolbox via homebrew cask and upgrade my docker-vm with the following commands:

docker-machine upgrade docker-dev

Where "docker-dev" is your docker-vm-Name in Virtualbox (start it, to see the correct name).

Now docker runs fine again and the docker version command brings a normal-setup`s output.

jonashackt
  • 12,022
  • 5
  • 67
  • 124