欢迎访问我的GitHub
这里分类和汇总了欣宸的全部原创(含配套源码):
https://github.com/zq2599/blog_demos
准备工作
安装docker-compose的步骤
apt-get update
apt-get install -y python python-pip
apt-get install libffi-dev
- 如果不安装libffi-dev的话,接下来在安装docker-compose的时候会报错,提示找不到ffi.h文件,错误信息如下:
aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-md9kAN/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-aarch64-2.7/c/_cffi_backend.o
c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
#include <ffi.h>
^~~~~~~
compilation terminated.
error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
pip install docker-compose
- 将python2.7的dist-packages文件夹复制到docker的工作目录下:
cd /usr/local/lib/python2.7/dist-packages && \
cp -r backports /usr/local/lib/python2.7/dist-packages/docker/transport/
- 如果不执行此操作,接下来在执行docker-compose命令的时候会报错,提示找不到名为ssl_match_hostname的module,错误信息如下:
File "/usr/local/lib/python2.7/dist-packages/docker/tls.py", line 5, in <module>
from .transport import SSLHTTPAdapter
File "/usr/local/lib/python2.7/dist-packages/docker/transport/__init__.py", line 3, in <module>
from .ssladapter import SSLHTTPAdapter
File "/usr/local/lib/python2.7/dist-packages/docker/transport/ssladapter.py", line 23, in <module>
from backports.ssl_match_hostname import match_hostname
ImportError: No module named ssl_match_hostname
- 此时已经安装成功了,执行命令docker-compose version试试:
root@raspbian:~# docker-compose version
docker-compose version 1.24.1, build 4667896
docker-py version: 3.7.3
CPython version: 2.7.16
OpenSSL version: OpenSSL 1.1.1c 28 May 2019
- 至此,在64位操作系统上安装docker-compose已经成功,希望您在安装的时候,本文能给您一些参考;
为什么不用官方的安装方式
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- 上述命令是下载指定地址的文件,这个地址的具体内容,我们可以用echo命令来查看:
root@raspbian:~/harbor# echo https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)
https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Linux-aarch64
- 综上所述,在Docker官方不支持的背景下,只能采用变通策略,用pip来安装了。
欢迎关注阿里云开发者社区博客:程序员欣宸
学习路上,你不孤单,欣宸原创一路相伴...