3

Any idea how to install docker-compose on Linux RHEL.

I followed below steps

sudo yum install epel-release
sudo yum install -y python-pip
sudo pip install docker-compose
sudo yum upgrade python*

I am getting below message when trying to check its version (docker-compose -version)

    Traceback (most recent call last):
  File "/usr/bin/docker-compose", line 7, in <module>
    from compose.cli.main import main
  File "/usr/lib/python2.6/site-packages/compose/cli/main.py", line 17, in <module>
    from . import errors
  File "/usr/lib/python2.6/site-packages/compose/cli/errors.py", line 10, in <module>
    from docker.errors import APIError
  File "/usr/lib/python2.6/site-packages/docker/__init__.py", line 3, in <module>
    from .client import DockerClient, from_env
  File "/usr/lib/python2.6/site-packages/docker/client.py", line 2, in <module>
    from .models.containers import ContainerCollection
  File "/usr/lib/python2.6/site-packages/docker/models/containers.py", line 874
    for network in networks}
      ^
SyntaxError: invalid syntax

Any idea about this issue or I make mistake in installation?

NGR
  • 1,230
  • 2
  • 15
  • 44

3 Answers3

7

RHEL6 and Centos6 most commonly use ancient docker-1.7.1 as installed with yum. It's only compatible with docker-compose-1.5.2 (or older), for which you can still (as of 2018) download a compiled binary:

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

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

ldd /usr/local/bin/docker-compose
        linux-vdso.so.1 =>  (0x00007ffffaed8000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f9d5e0c3000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f9d5dead000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f9d5db19000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f9d5e2c7000)

Remember, your docker-compose.yml is limited to syntax version 1. Although that link says docker 1.7.1 is unsupported, it will work; I use it without problems.

kubanczyk
  • 5,184
  • 1
  • 41
  • 52
1

RHEL 6 is not recommended and not supported for Docker use.

There was many addition made to recent version of Linux kernels that allows Docker, but they are missing on RHEL 6 because it is designed to be an enterprise system with very long term support (10 years).

Simply put it is too old, and Red Hat themselves aren't porting Docker on it.

zlig
  • 103
  • 1
  • 2
  • 11
  • 1
    Is it not recommended for RHEL 6.6 or they don't have any docker-compose for it? – NGR Mar 08 '17 at 14:01
  • The resolution section from the Red Hat link in my reply states: _The version of docker that is maintained and supported by Red Hat is only available on RHEL 7 and above_. From experience, it is a matter of minutes to get it working on RHEL7.. – zlig Mar 08 '17 at 15:53
0

I doubt that the problem is with the installation. Still, you can refer to this web-page.

According to the error you are getting, seems like there's some issue with the file /usr/lib/python2.6/site-packages/docker/models/containers.py.

Why don't you check if there had been some modifications in that file. Otherwise you can clean install the docker-compose using the github repository.

  • I cleaned and installed the docker-compose using the github repository. "docker-compose version" works. But when tried "docker-compose up", it started giving me error that you need at least 1.9.0 or greater version of docker. I installed docker using "yum install docker-io" and it installed 1.7V of docker. Don't know how to have 1.9 or greater version of docker? – NGR Mar 08 '17 at 14:00
  • Then it might be the reason that zlig mentioned. RHEL 6 might not be supported by docker anymore. what you can try is, use docker machine. Install docker/docker-machine on a separate machine (with RHEL 7+) and create this machine as remote host using that. you can also create a VM and install Docker on it. –  Mar 09 '17 at 08:45