执行docker-compose -V报错及升级后报/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28‘ not found问题解决记录

47 篇文章 0 订阅
29 篇文章 0 订阅

在试用一个开源项目时需要用到docker-compose,执行项目提供的脚本:

> ./docker/up.sh
Builds, (re)creates, starts, and attaches to containers for a service.

Unless they are already running, this command also starts any linked services.

The `docker-compose up` command aggregates the output of each container. When
the command exits, all containers are stopped. Running `docker-compose up -d`
starts the containers in the background and leaves them running.

If there are existing containers for a service, and the service's configuration
or image was changed after the container's creation, `docker-compose up` picks
up the changes by stopping and recreating the containers (preserving mounted
volumes). To prevent Compose from picking up changes, use the `--no-recreate`
flag.

If you want to force Compose to stop and recreate all containers, use the
`--force-recreate` flag.

Usage: up [options] [--scale SERVICE=NUM...] [SERVICE...]

Options:
    -d                         Detached mode: Run containers in the background,
                               print new container names.
                               Incompatible with --abort-on-container-exit.
    --no-color                 Produce monochrome output.
    --no-deps                  Don't start linked services.
    --force-recreate           Recreate containers even if their configuration
                               and image haven't changed.
                               Incompatible with --no-recreate.
    --no-recreate              If containers already exist, don't recreate them.
                               Incompatible with --force-recreate.
    --no-build                 Don't build an image, even if it's missing.
    --no-start                 Don't start the services after creating them.
    --build                    Build images before starting containers.
    --abort-on-container-exit  Stops all containers if any container was stopped.
                               Incompatible with -d.
    -t, --timeout TIMEOUT      Use this timeout in seconds for container shutdown
                               when attached or when containers are already
                               running. (default: 10)
    --remove-orphans           Remove containers for services not
                               defined in the Compose file
    --exit-code-from SERVICE   Return the exit code of the selected service container.
                               Implies --abort-on-container-exit.
    --scale SERVICE=NUM        Scale SERVICE to NUM instances. Overrides the `scale`
                               setting in the Compose file if present.

从报错信息能看出,是脚本中使用docker-compose时提供的参数不符合要求。检查下脚本:


> cat up.sh 
#!/bin/bash
...

set -e

usage() {
  echo "usage: ./$(basename -- ${0}) [--build] [--seed]"
  exit 1
}

# Change working directory to project root
project_root=$(git rev-parse --show-toplevel)
cd "${project_root}"

compose_files="-f docker-compose.yml"
args="-V --force-recreate"

while [ $# -gt 0 ]; do
  case $1 in
    '--build'|-b)
       BUILD='true'
       ;;

...

从脚本中不难看出执行compose时使用了-V参数,对比上面的compose提示信息,当前版本的compose是不支持-V参数的。可以修改为对应的参数也可以换成合适版本的compose.

检查了下当前的docker-compose版本:

>docker-compose --version
docker-compose version 1.17.1, build unknown

哎呀我地哪个娘啦,这个版本也太低了点,compose已经发布了1.28版本.因此决定升级compose到最新的版本,下载好安装包后,还好先执行测试了下:

dlopen: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /tmp/_MEIBAAUTB/libpython3.9.so.1.0)

从错误信息可以看出当前下载的安装包需要GLIC_2.28,当前系统环境没有啊,如果要用需要升级系统的GLIBC,这太危险了,一不小心系统就挂了。那咋办呢?

还好compose也支持以docker方式运行,官方还提供了安装脚本:

> sudo curl -L --fail https://github.com/docker/compose/releases/download/1.28.0/run.sh -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   630  100   630    0     0    967      0 --:--:-- --:--:-- --:--:--   967
100  2585  100  2585    0     0   1375      0  0:00:01  0:00:01 --:--:--  3550
> sudo chmod +x /usr/local/bin/docker-compose
> /usr/local/bin/docker-compose -v

第一次运行docker-compose时会去下载相应版本的compose镜像,需要点时间,以后就会直接运行,也是挺快的。

可以把原来版本的docker-compose删除掉了.

再次运行开源项目的执行脚本就正常了:

问题解决了!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一个不安分的程序员

祝您财源广进

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值