樹莓派4B已裝好64位Linux,而且裝好了19.03.1版本的Docker,具體的安裝步驟請參考《樹莓派4B安裝64位Linux(不用顯示器鍵盤鼠標)》python
apt-get update複製代碼
apt-get install -y python python-pip複製代碼
apt-get install libffi-dev複製代碼
若是不安裝libffi-dev的話,接下來在安裝docker-compose的時候會報錯,提示找不到ffi.h文件,錯誤信息以下:linux
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複製代碼
cd /usr/local/lib/python2.7/dist-packages && \
cp -r backports /usr/local/lib/python2.7/dist-packages/docker/transport/複製代碼
若是不執行此操做,接下來在執行docker-compose命令的時候會報錯,提示找不到名爲sslmatchhostname的module,錯誤信息以下:git
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
···
6. 此時已經安裝成功了,執行命令<font color="blue">docker-compose version</font>試試:複製代碼
root@raspbian:~# docker-compose versiondocker-compose version 1.24.1, build 4667896docker-py version: 3.7.3CPython version: 2.7.16OpenSSL version: OpenSSL 1.1.1c 28 May 2019github
至此,在64位操做系統上安裝docker-compose已經成功,但願您在安裝的時候,本文能給您一些參考;
### 爲何不用官方的安裝方式
不管什麼時候,官方的安裝方法都是首選,那麼本文爲什麼要本身折騰這麼多步驟呢?
1. 咱們來看下官方安裝docker-compose的步驟,地址是:https://docs.docker.com/compose/install/ ,第一步是下載:複製代碼
sudo curl -L "https://github.com/docker/compose/releases/download/1.24.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-composedocker
2. 上述命令是下載指定地址的文件,這個地址的具體內容,咱們能夠用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-compose的下載地址是https://github.com/docker/compose/releases/download/1.24.1/docker-compose-Linux-aarch64,這樣的地址可否下載到對應的文件,您將其粘貼在瀏覽器訪問一下便知道,這個地址會返回404錯誤;瀏覽器