ubuntu16.04 升级内核版本到 4.4.0-117-generic docker-compose 不能工作

使用的是ubuntu16.04系统,内核升级前

aht@tr:/opt/gopath/src/github.com/hyperledger/fabric/bddtests$ uname -a
Linux tr 4.4.0-116-generic #141-Ubuntu SMP Tue Mar 13 11:58:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
a

升级内核后

aht@tr:/opt/gopath/src/github.com/hyperledger/fabric/bddtests$ uname -a
Linux tr 4.4.0-117-generic #141-Ubuntu SMP Tue Mar 13 11:58:07 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
a

但是之前在 4.4.0-116-generic 内核下通过 apt-get install docker-compose 安装的 docker-compose 不能工作。docker-compose --version 没有任何提示,也不报错。

使用下面的python脚本调用,会报错

#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import re
import subprocess
import sys

if __name__ == "__main__":
	#docker-compose 
	xx="-f dc-base.yml -f dc-peer-couchdb.yml -f dc-orderer-kafka.yml config --services"
	arg_list = xx.split(' ')
	env = os.environ.copy()
	p = subprocess.Popen(arg_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env, executable="/usr/local/bin/docker-compose")
	output, error = p.communicate()
	if p.returncode == 0:
		if output is not None:
		    print("Output:\n" + output)
		if error is not None:
		    print("Error Message:\n" + error)
		if expect_success:
		    raise subprocess.CalledProcessError(p.returncode, arg_list, output)

报告的错误如下

OSError: [Errno 8] Exec format error

解决方案

下载最新的docker-compose版本 1.20.1

https://github.com/docker/compose/releases

放在/usr/bin下,并ln -s .


你可能感兴趣的:(运维)