简体   繁体   中英

How to install docker-compose on Linux RHEL 6.6?

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?

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.

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 .

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.

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