Docker Compose installation methods in different environments

Docker Compose installation methods in different environments

1. Online installation

Currently only tried the Linux x86 architecture online installation

1. Download docker-compose

Download docker-compose to /usr/local/bin/

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

2. Give docker-compose execution permissions

$ sudo chmod +x /usr/local/bin/docker-compose

3. Verify

[root@localhost bin]# docker-compose -version
docker-compose version 1.21.2, build e7de1bc

2. Offline installation

(I) Linux x86 installation process of docker-compose

Method 1. Install using binary files

For linux x86, just download the docker-compose binary file of the corresponding linux version from https://github.com/docker/compose/releases to your local computer and send it to linux, then copy it to /usr/local/bin/ and you can use it normally.

Method 2. Compile and install using Python

Download the dockerCompoes source code from github. Then follow these steps:

  • Enter the source directory of docker-compose
  • Execute python setup.py install

2. Other system installation processes without binary files

The docker-compose binary files for some architectures are not officially provided and need to be compiled and installed manually. Other official ones also need to be compiled and installed manually using Python

After trying, I found that it seems that only using python compilation can be successfully installed, and the following three methods all failed.

Compile and install using Python

Use docker-compose github source code and python compile and install.

  • Enter the source directory of docker-compose
  • Execute python setup.py install

Report an error

It keeps reporting requests10 version error. I deleted version 10 and changed to version 16. It also reports requests2.14 or above, which is required by docker. This means that the downloaded docker-compose source version does not correspond to the installed docker version.

Download and check the requests version in the requirements.txt file under the source code, find the version corresponding to the installed docker, and then install it again. The texttable version is reported to be incorrect again. Moreover, it cannot be downloaded automatically without a network connection. You can only manually go to https://pypi.org/project/texttable/ to find the corresponding version, download, compile and install it.

Fix missing dependencies

For such problems with missing dependencies, you need to download it from the Python official website and then compile and install it. An example:

Install the two dependencies, requests and texttable, and make sure that docker-compose corresponds to the docker version. Continue to compile and install Python

  1. Enter the docker-compose source directory
  2. Execute python setup.py install

Error:

Installed /usr/lib/python2.7/site-packages/docker_compose-1.21.2-py2.7.egg
Processing dependencies for docker-compose==1.21.2
Searching for docker<4.0,>=3.3.0
Reading https://pypi.python.org/simple/docker/
Download error on https://pypi.python.org/simple/docker/: [Errno -2] Name or service not known -- Some packages may not be found!
Couldn't retrieve index page for 'docker'
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [Errno -2] Name or service not known -- Some packages may not be found!
No local packages or download links found for docker<4.0,>=3.3.0
error: Could not find suitable distribution for Requirement.parse('docker<4.0,>=3.3.0')

Reason: The docker version under python is wrong. Go to https://pypi.python.org/simpl... again and compile and install

Enter the downloaded python docker3.3.0 directory and execute the command python setup.py install
Output:

...
...Using /usr/lib/python2.7/site-packages/idna-2.5-py2.7.egg
Searching for chardet==3.0.2
Best match: chardet 3.0.2
Processing chardet-3.0.2-py2.7.egg
chardet 3.0.2 is already the active version in easy-install.pth
Installing chardetect script to /usr/bin

Using /usr/lib/python2.7/site-packages/chardet-3.0.2-py2.7.egg
Finished processing dependencies for docker==3.3.0

Enter the docker-compose-1.21.2 directory again

Install docker-compose using python

  [root@localhost docker-3.3.0]# cd ../docker-compose-1.21.2/
  [root@localhost docker-compose-1.21.2]# ls
  build compose dist LICENSE README.rst setup.cfg tests
  CHANGELOG.md contrib docker_compose.egg-info MANIFEST.in requirements-dev.txt setup.py tox.ini
  CHANGES.md CONTRIBUTING.md Dockerfile   
  [root@localhost docker-compose-1.21.2]# python setup.py install

Finally, the installation is successful and it shows:

Using /usr/lib/python2.7/site-packages/idna-2.5-py2.7.egg
Searching for chardet==3.0.2
Best match: chardet 3.0.2
Processing chardet-3.0.2-py2.7.egg
chardet 3.0.2 is already the active version in easy-install.pth
Installing chardetect script to /usr/bin

Using /usr/lib/python2.7/site-packages/chardet-3.0.2-py2.7.egg
Finished processing dependencies for docker-compose==1.21.2

4. Establish a soft connection

[root@localhost bin]# ln -s /usr/bin/docker-compose /usr/local/bin/docker-compose

5. Verify

[root@localhost bin]# docker-compose -version
docker-compose version 1.21.2, build e7de1bc

3. Others

How to install python modules through setup.py

  • Enter the installation directory
  • python setup.py build
  • python setup.py install

Other failed installation attempts
1. Use binary file installation to find the compiled binary file and try to put it under /usr/local/bin. An error is reported: Unable to execute this binary file.

2. Use dep to install and download the corresponding dep installation package, unzip the data file, put docker-compose in /usr/local/bin, and execute the error: /usr/bin/python3: bad interpreter looking for mirror, no available mirror found

3. Make installation When I started to use make to install, I found that the configuration file usually compiled and installed under Linux was missing. I used ./configuration and it reported an error that the file could not be found.

This concludes this article about various ways to install Docker Compose in different environments. For more information about various ways to install Docker Compose, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Docker-compose tutorial installation and quick start
  • Docker and Docker-compose one-click installation tutorial (supports online and offline)
  • Two simplest ways to install docker-compose
  • Detailed example of installing docker and docker-compose
  • Detailed steps for installing and setting up Docker-compose
  • Practical notes on installing Jenkins with docker-compose

<<:  MySQL learning record: bloody incident caused by KEY partition

>>:  Vue template compilation details

Recommend

Use the Linux seq command to generate a sequence of numbers (recommended)

The Linux seq command can generate lists of numbe...

How to quickly modify the host attribute of a MySQL user

When you log in to MySQL remotely, the account yo...

Detailed explanation of HTML's <input> tag and how to disable it

Definition and Usage The <input> tag is use...

Spring Boot layered packaging Docker image practice and analysis (recommended)

Table of contents 1. Prepare the springboot proje...

Docker swarm simple tutorial

swarm three virtual machines 132,133,134 1. Initi...

JavaScript implementation of carousel example

This article shares the specific code for JavaScr...

Example of how to implement MySQL cascading replication

The so-called cascading replication is that the m...

JavaScript using Ckeditor + Ckfinder file upload case detailed explanation

Table of contents 1. Preparation 2. Decompression...

React-native sample code to implement the shopping cart sliding deletion effect

Basically all e-commerce projects have the functi...

Example of using docker compose to build a consul cluster environment

Basic concepts of consul Server mode and client m...