7 安裝 docker-compose
(1) 首先檢視系統內 是否安裝 python-pip
[[email protected] jenkins]# pip -V
-bash: pip: command not found
(2)若沒有安裝則進行python-pip
[[email protected] jenkins]# yum -y install epel-release
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
docker-ce-stable | 2.9 kB 00:00:00
extras | 3.4 kB 00:00:00
mysql-connectors-community | 2.5 kB 00:00:00
mysql-tools-community | 2.5 kB 00:00:00
mysql57-community | 2.5 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/5): mysql-tools-community/x86_64/primary_db | 45 kB 00:00:00
(2/5): extras/7/x86_64/primary_db | 173 kB 00:00:00
(3/5): mysql-connectors-community/x86_64/primary_db | 25 kB 00:00:05
(4/5): mysql57-community/x86_64/primary_db | 152 kB 00:00:06
(5/5): updates/7/x86_64/primary_db | 4.3 MB 00:00:38
Determining fastest mirrors
* base: mirrors.aliyun.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package epel-release.noarch 0:7-11 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
epel-release noarch 7-11 extras 15 k
Transaction Summary
========================================================================================================================================================================
Install 1 Package
Total download size: 15 k
Installed size: 24 k
Downloading packages:
epel-release-7-11.noarch.rpm | 15 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : epel-release-7-11.noarch 1/1
Verifying : epel-release-7-11.noarch 1/1
Installed:
epel-release.noarch 0:7-11
Complete!
[[email protected] jenkins]# yum install python-pip
Loaded plugins: fastestmirror, langpacks
epel/x86_64/metalink | 8.0 kB 00:00:00
epel | 3.2 kB 00:00:00
(1/3): epel/x86_64/group_gz | 88 kB 00:00:00
(2/3): epel/x86_64/primary | 3.6 MB 00:00:32
(3/3): epel/x86_64/updateinfo | 932 kB 00:00:36
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.huaweicloud.com
* updates: mirrors.aliyun.com
epel 12629/12629
Resolving Dependencies
--> Running transaction check
---> Package python2-pip.noarch 0:8.1.2-6.el7 will be installed
--> Processing Dependency: python-setuptools for package: python2-pip-8.1.2-6.el7.noarch
--> Running transaction check
---> Package python-setuptools.noarch 0:0.9.8-7.el7 will be installed
--> Processing Dependency: python-backports-ssl_match_hostname for package: python-setuptools-0.9.8-7.el7.noarch
--> Running transaction check
---> Package python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 will be installed
--> Processing Dependency: python-ipaddress for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Processing Dependency: python-backports for package: python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch
--> Running transaction check
---> Package python-backports.x86_64 0:1.0-8.el7 will be installed
---> Package python-ipaddress.noarch 0:1.0.16-2.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================================================================================
Package Arch Version Repository Size
========================================================================================================================================================================
Installing:
python2-pip noarch 8.1.2-6.el7 epel 1.7 M
Installing for dependencies:
python-backports x86_64 1.0-8.el7 base 5.8 k
python-backports-ssl_match_hostname noarch 3.5.0.1-1.el7 base 13 k
python-ipaddress noarch 1.0.16-2.el7 base 34 k
python-setuptools noarch 0.9.8-7.el7 base 397 k
Transaction Summary
========================================================================================================================================================================
Install 1 Package (+4 Dependent packages)
Total download size: 2.1 M
Installed size: 9.4 M
Is this ok [y/d/N]: y
Downloading packages:
(1/5): python-backports-1.0-8.el7.x86_64.rpm | 5.8 kB 00:00:00
(2/5): python-ipaddress-1.0.16-2.el7.noarch.rpm | 34 kB 00:00:00
(3/5): python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch.rpm | 13 kB 00:00:00
(4/5): python-setuptools-0.9.8-7.el7.noarch.rpm | 397 kB 00:00:05
warning: /var/cache/yum/x86_64/7/epel/packages/python2-pip-8.1.2-6.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY08 kB/s | 2.1 MB 00:00:00 ETA
Public key for python2-pip-8.1.2-6.el7.noarch.rpm is not installed
(5/5): python2-pip-8.1.2-6.el7.noarch.rpm | 1.7 MB 00:00:23
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 92 kB/s | 2.1 MB 00:00:23
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Importing GPG key 0x352C64E5:
Userid : "Fedora EPEL (7) <[email protected]>"
Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
Package : epel-release-7-11.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : python-backports-1.0-8.el7.x86_64 1/5
Installing : python-ipaddress-1.0.16-2.el7.noarch 2/5
Installing : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 3/5
Installing : python-setuptools-0.9.8-7.el7.noarch 4/5
Installing : python2-pip-8.1.2-6.el7.noarch 5/5
Verifying : python-ipaddress-1.0.16-2.el7.noarch 1/5
Verifying : python-setuptools-0.9.8-7.el7.noarch 2/5
Verifying : python2-pip-8.1.2-6.el7.noarch 3/5
Verifying : python-backports-1.0-8.el7.x86_64 4/5
Verifying : python-backports-ssl_match_hostname-3.5.0.1-1.el7.noarch 5/5
Installed:
python2-pip.noarch 0:8.1.2-6.el7
Dependency Installed:
python-backports.x86_64 0:1.0-8.el7 python-backports-ssl_match_hostname.noarch 0:3.5.0.1-1.el7 python-ipaddress.noarch 0:1.0.16-2.el7
python-setuptools.noarch 0:0.9.8-7.el7
Complete!
(3) 對安裝好的python-pip 進行更新
[[email protected] jenkins]# pip install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 22kB/s
Installing collected packages: pip
Found existing installation: pip 8.1.2
Uninstalling pip-8.1.2:
Successfully uninstalled pip-8.1.2
Successfully installed pip-18.0
(4) 檢視 python-pip 版本
[[email protected] jenkins]# pip -V
pip 18.0 from /usr/lib/python2.7/site-packages/pip (python 2.7)
(5) 安裝docker-compose
[[email protected] jenkins]# pip install docker-compose
Collecting docker-compose
(出現異常)
Could not find a version that satisfies the requirement docker-compose (from versions: )
No matching distribution found for docker-compose
(6) 更換 安裝docker-compose命令
[[email protected] jenkins]# pip --default-timeout=200 install -U docker-compose
Collecting docker-compose
Downloading https://files.pythonhosted.org/packages/67/03/b833b571595e05c933d3af3685be3b27b1166c415d005b3eadaa5be80d25/docker_compose-1.22.0-py2.py3-none-any.whl (126kB)
100% |████████████████████████████████| 133kB 37kB/s
Collecting requests!=2.11.0,!=2.12.2,!=2.18.0,<2.19,>=2.6.1 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/49/df/50aa1999ab9bde74656c2919d9c0c085fd2b3775fd3eca826012bef76d8c/requests-2.18.4-py2.py3-none-any.whl (88kB)
100% |████████████████████████████████| 92kB 30kB/s
Collecting texttable<0.10,>=0.9.0 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/02/e1/2565e6b842de7945af0555167d33acfc8a615584ef7abd30d1eae00a4d80/texttable-0.9.1.tar.gz
Requirement already satisfied, skipping upgrade: backports.ssl-match-hostname>=3.5; python_version < "3.5" in /usr/lib/python2.7/site-packages (from docker-compose) (3.5.0.1)
Requirement already satisfied, skipping upgrade: ipaddress>=1.0.16; python_version < "3.3" in /usr/lib/python2.7/site-packages (from docker-compose) (1.0.16)
Collecting jsonschema<3,>=2.5.1 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/77/de/47e35a97b2b05c2fadbec67d44cfcdcd09b8086951b331d82de90d2912da/jsonschema-2.6.0-py2.py3-none-any.whl
Collecting cached-property<2,>=1.2.0 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/88/09/4b7a484f96cbceda746e03f0167021c909c3ceae1c6f2e844d79476cb70e/cached_property-1.4.3-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: six<2,>=1.3.0 in /usr/lib/python2.7/site-packages (from docker-compose) (1.9.0)
Collecting enum34<2,>=1.0.4; python_version < "3.4" (from docker-compose)
Downloading https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl
Collecting websocket-client<1.0,>=0.32.0 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/8a/a1/72ef9aa26cfe1a75cee09fc1957e4723add9de098c15719416a1ee89386b/websocket_client-0.48.0-py2.py3-none-any.whl (198kB)
100% |████████████████████████████████| 204kB 51kB/s
Collecting PyYAML<4,>=3.10 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/9e/a3/1d13970c3f36777c583f136c136f804d70f500168edc1edea6daa7200769/PyYAML-3.13.tar.gz (270kB)
100% |████████████████████████████████| 276kB 69kB/s
Collecting dockerpty<0.5,>=0.4.1 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/8d/ee/e9ecce4c32204a6738e0a5d5883d3413794d7498fe8b06f44becc028d3ba/dockerpty-0.4.1.tar.gz
Collecting docopt<0.7,>=0.6.1 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz
Collecting docker<4.0,>=3.4.1 (from docker-compose)
Downloading https://files.pythonhosted.org/packages/a5/64/8c0a5d22e70257e6b7ef7f14b577f99f0b9b1560c604f87856d0db80d151/docker-3.4.1-py2.py3-none-any.whl (124kB)
100% |████████████████████████████████| 133kB 92kB/s
Collecting chardet<3.1.0,>=3.0.2 (from requests!=2.11.0,!=2.12.2,!=2.18.0,<2.19,>=2.6.1->docker-compose)
Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
100% |████████████████████████████████| 143kB 88kB/s
Collecting certifi>=2017.4.17 (from requests!=2.11.0,!=2.12.2,!=2.18.0,<2.19,>=2.6.1->docker-compose)
Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
100% |████████████████████████████████| 153kB 61kB/s
Collecting urllib3<1.23,>=1.21.1 (from requests!=2.11.0,!=2.12.2,!=2.18.0,<2.19,>=2.6.1->docker-compose)
Downloading https://files.pythonhosted.org/packages/63/cb/6965947c13a94236f6d4b8223e21beb4d576dc72e8130bd7880f600839b8/urllib3-1.22-py2.py3-none-any.whl (132kB)
100% |████████████████████████████████| 133kB 58kB/s
Collecting idna<2.7,>=2.5 (from requests!=2.11.0,!=2.12.2,!=2.18.0,<2.19,>=2.6.1->docker-compose)
Downloading https://files.pythonhosted.org/packages/27/cc/6dd9a3869f15c2edfab863b992838277279ce92663d334df9ecf5106f5c6/idna-2.6-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 75kB/s
Collecting functools32; python_version == "2.7" (from jsonschema<3,>=2.5.1->docker-compose)
Downloading https://files.pythonhosted.org/packages/c5/60/6ac26ad05857c601308d8fb9e87fa36d0ebf889423f47c3502ef034365db/functools32-3.2.3-2.tar.gz
Collecting docker-pycreds>=0.3.0 (from docker<4.0,>=3.4.1->docker-compose)
Downloading https://files.pythonhosted.org/packages/ea/bf/7e70aeebc40407fbdb96fa9f79fc8e4722ea889a99378303e3bcc73f4ab5/docker_pycreds-0.3.0-py2.py3-none-any.whl
Installing collected packages: chardet, certifi, urllib3, idna, requests, texttable, functools32, jsonschema, cached-property, enum34, websocket-client, PyYAML, dockerpty, docopt, docker-pycreds, docker, docker-compose
Found existing installation: chardet 2.2.1
Uninstalling chardet-2.2.1:
Successfully uninstalled chardet-2.2.1
Running setup.py install for texttable ... done
Running setup.py install for functools32 ... done
Running setup.py install for PyYAML ... done
Running setup.py install for dockerpty ... done
Running setup.py install for docopt ... done
Successfully installed PyYAML-3.13 cached-property-1.4.3 certifi-2018.4.16 chardet-3.0.4 docker-3.4.1 docker-compose-1.22.0 docker-pycreds-0.3.0 dockerpty-0.4.1 docopt-0.6.2 enum34-1.1.6 functools32-3.2.3.post2 idna-2.6 jsonschema-2.6.0 requests-2.18.4 texttable-0.9.1 urllib3-1.22 websocket-client-0.48.0
(7) 安裝成功 ,檢視版本資訊
[[email protected] jenkins]# docker-compose -version
docker-compose version 1.22.0, build f46880f