CentOS7 AltArch aarch64环境编译docker-compose

linux 同时被 2 个专栏收录
87 篇文章 0 订阅
20 篇文章 0 订阅

起因

采用源码自带的构建脚本script/build/linux 构建出来的可执行程序,由于与容器内的glibc版本不一致启动报错

# ./dist/docker-compose-Linux-aarch64 
[16739] Error loading Python lib '/tmp/_MEIId3Clk/libpython3.6m.so.1.0': dlopen: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by /tmp/_MEIId3Clk/libpython3.6m.so.1.0)

解决

参考源码中Dockerfile script/build/目录内的脚本,在宿主服务器上构建

下载源码并解压

wget https://github.com/docker/compose/archive/1.23.2.tar.gz -O docker-compose-1.23.2.tar.gz
tar -xvf docker-compose-1.23.2.tar.gz
cd compose-1.23.2/

配置pip源 /root/.pip/pip.conf

[global]
trusted-host =  mirrors.aliyun.com
index-url = https://mirrors.aliyun.com/pypi/simple

安装构建依赖

yum install git python36 python36-devel python36-pip zlib-devel -y

安装tox并初始化

pip3.6 install tox==2.1.1
# /usr/local/bin/tox --notest -i https://mirrors.aliyun.com/pypi/simple
py27 create: /root/Downloads/compose-1.23.2/.tox/py27
py27 installdeps: -rrequirements.txt, -rrequirements-dev.txt
py27 develop-inst: /root/Downloads/compose-1.23.2
py27 installed: atomicwrites==1.4.0,attrs==20.1.0,backports.ssl-match-hostname==3.5.0.1,cached-property==1.3.0,certifi==2017.4.17,chardet==3.0.4,configparser==4.0.2,coverage==4.4.2,docker==3.6.0,# Editable install with no version control (docker-compose==1.23.2),-e /root/Downloads/compose-1.23.2,docker-pycreds==0.3.0,dockerpty==0.4.1,docopt==0.6.2,enum34==1.1.6,flake8==3.5.0,funcsigs==1.0.2,functools32==3.2.3.post2,idna==2.5,ipaddress==1.0.18,jsonschema==2.6.0,mccabe==0.6.1,mock==3.0.5,more-itertools==5.0.0,pluggy==0.6.0,py==1.9.0,pycodestyle==2.3.1,pyflakes==1.6.0,PySocks==1.6.7,pytest==3.6.3,pytest-cov==2.5.1,PyYAML==3.12,requests==2.20.0,six==1.10.0,texttable==0.9.1,urllib3==1.24.3,websocket-client==0.32.0
py36 create: /root/Downloads/compose-1.23.2/.tox/py36
py36 installdeps: -rrequirements.txt, -rrequirements-dev.txt
py36 develop-inst: /root/Downloads/compose-1.23.2
py36 installed: atomicwrites==1.4.0,attrs==20.1.0,cached-property==1.3.0,certifi==2017.4.17,chardet==3.0.4,coverage==4.4.2,docker==3.6.0,# Editable install with no version control (docker-compose==1.23.2),-e /root/Downloads/compose-1.23.2,docker-pycreds==0.3.0,dockerpty==0.4.1,docopt==0.6.2,flake8==3.5.0,idna==2.5,ipaddress==1.0.18,jsonschema==2.6.0,mccabe==0.6.1,mock==4.0.2,more-itertools==8.4.0,pluggy==0.6.0,py==1.9.0,pycodestyle==2.3.1,pyflakes==1.6.0,PySocks==1.6.7,pytest==3.6.3,pytest-cov==2.5.1,PyYAML==3.12,requests==2.20.0,six==1.10.0,texttable==0.9.1,urllib3==1.24.3,websocket-client==0.32.0
py37 create: /root/Downloads/compose-1.23.2/.tox/py37
py37 installdeps: -rrequirements.txt, -rrequirements-dev.txt
py37 develop-inst: /root/Downloads/compose-1.23.2
py37 installed: atomicwrites==1.4.0,attrs==20.1.0,cached-property==1.3.0,certifi==2017.4.17,chardet==3.0.4,coverage==4.4.2,docker==3.6.0,# Editable install with no version control (docker-compose==1.23.2),-e /root/Downloads/compose-1.23.2,docker-pycreds==0.3.0,dockerpty==0.4.1,docopt==0.6.2,flake8==3.5.0,idna==2.5,ipaddress==1.0.18,jsonschema==2.6.0,mccabe==0.6.1,mock==4.0.2,more-itertools==8.4.0,pluggy==0.6.0,py==1.9.0,pycodestyle==2.3.1,pyflakes==1.6.0,PySocks==1.6.7,pytest==3.6.3,pytest-cov==2.5.1,PyYAML==3.12,requests==2.20.0,six==1.10.0,texttable==0.9.1,urllib3==1.24.3,websocket-client==0.32.0
pre-commit create: /root/Downloads/compose-1.23.2/.tox/pre-commit
pre-commit installdeps: pre-commit
pre-commit develop-inst: /root/Downloads/compose-1.23.2
pre-commit installed: appdirs==1.4.4,cached-property==1.5.1,certifi==2020.6.20,cfgv==3.2.0,chardet==3.0.4,distlib==0.3.1,docker==3.7.3,# Editable install with no version control (docker-compose==1.23.2),-e /root/Downloads/compose-1.23.2,docker-pycreds==0.4.0,dockerpty==0.4.1,docopt==0.6.2,filelock==3.0.12,identify==1.4.29,idna==2.7,importlib-metadata==1.7.0,importlib-resources==3.0.0,jsonschema==2.6.0,nodeenv==1.5.0,pre-commit==2.7.1,PyYAML==3.13,requests==2.20.1,six==1.15.0,texttable==0.9.1,toml==0.10.1,urllib3==1.24.3,virtualenv==20.0.31,websocket-client==0.57.0,zipp==3.1.0
_______________________________________________________________ summary _______________________________________________________________
  py27: skipped tests
  py36: skipped tests
  py37: skipped tests
  pre-commit: skipped tests
  congratulations :)

执行编译脚本

TARGET=dist/docker-compose-$(uname -s)-$(uname -m)
VENV=.tox/py36

mkdir -p `pwd`/dist
chmod 777 `pwd`/dist
echo "b0c10cb" > compose/GITSHA
$VENV/bin/pip install -q -r requirements-build.txt
$VENV/bin/pyinstaller docker-compose.spec
mv dist/docker-compose $TARGET
$TARGET version

得到版本信息

docker-compose version 1.23.2, build b0c10cb
docker-py version: 3.6.0
CPython version: 3.6.8
OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017

 

  • 1
    点赞
  • 0
    评论
  • 2
    收藏
  • 一键三连
    一键三连
  • 扫一扫,分享海报

©️2021 CSDN 皮肤主题: 鲸 设计师:meimeiellie 返回首页
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值