本文主要是介绍执行docker-compose -V报错及升级后报/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28‘ not found问题解决记录,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在试用一个开源项目时需要用到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删除掉了.
再次运行开源项目的执行脚本就正常了:
问题解决了!
这篇关于执行docker-compose -V报错及升级后报/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28‘ not found问题解决记录的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!