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

How to run MySQL using docker-compose

Directory Structure . │ .env │ docker-compose.yml...

Using js to implement the two-way binding function of data in Vue2.0

Object.defineProperty Understanding grammar: Obje...

Introduction to CSS3 color value RGBA and gradient color usage

Before CSS3, gradient images could only be used a...

Teach you how to build a react+antd project from scratch

The previous articles were all my own learning lo...

Setting up shadowsocks+polipo global proxy in Linux environment

1. Install shadowsocks sudo apt-get install pytho...

How to manually encapsulate paging components in Vue3.0

This article shares the specific code of the vue3...

How to get the intersection/difference/union of two sets in mysql

Common scenarios of MySQL: getting the intersecti...

Example of configuring multiple SSL certificates for a single Nginx IP address

By default, Nginx supports only one SSL certifica...

HTML table tag tutorial (46): table footer tag

The <tfoot> tag is used to define the style...

Detailed explanation of the 14 common HTTP status codes returned by the server

HTTP Status Codes The status code is composed of ...

HTML+CSS+JavaScript to create a simple tic-tac-toe game

Table of contents Implementing HTML Add CSS Imple...

Detailed explanation of the usage and function of MySQL cursor

[Usage and function of mysql cursor] example: The...

Use CSS to draw a file upload pattern

As shown below, if it were you, how would you ach...

Detailed examples of Zabbix remote command execution

Table of contents one. environment two. Precautio...