执行docker-compose报错:Segmentation fault

故障

  • 执行docker-compose报错:Segmentation fault

  • 但是执行docker ps查看正在运行的容器没问题

解决办法

  • 重新安装docker-compose

  • 具体安装步骤可查看站内文章

  • 也可以直接复制下面的命令操作

root@NAS:~# docker-compose
Segmentation fault  # 报错
root@NAS:~# docker ps  # 查看容器命令正常
CONTAINER ID   IMAGE                         COMMAND   CREATED       STATUS       PORTS                                                                                                                             NAMES
6996e83e76ef   superng6/qbittorrent:latest   "/init"   8 hours ago   Up 2 hours   0.0.0.0:6881->6881/tcp, 0.0.0.0:6881->6881/udp, :::6881->6881/tcp, :::6881->6881/udp, 0.0.0.0:8885->8080/tcp, :::8885->8080/tcp   qbittorrent
root@NAS:~# wget https://github.com/docker/compose/releases/download/v2.14.2/docker-compose-linux-x86_64  # 重新拉取docker-compose文件
--2023-12-08 19:26:21--  https://github.com/docker/compose/releases/download/v2.14.2/docker-compose-linux-x86_64
Connecting to 192.168.2.222:7890... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://objects.githubusercontent.com/github-production-release-asset-2e65be/15045751/fc8fa88e-72b4-453b-9cce-61ccc184629d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231208%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231208T112622Z&X-Amz-Expires=300&X-Amz-Signature=ca69154889355b796b906f6a965dd94bd890760cb61eb257da993d6f4d2d64ed&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=15045751&response-content-disposition=attachment%3B%20filename%3Ddocker-compose-linux-x86_64&response-content-type=application%2Foctet-stream [following]
--2023-12-08 19:26:22--  https://objects.githubusercontent.com/github-production-release-asset-2e65be/15045751/fc8fa88e-72b4-453b-9cce-61ccc184629d?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231208%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231208T112622Z&X-Amz-Expires=300&X-Amz-Signature=ca69154889355b796b906f6a965dd94bd890760cb61eb257da993d6f4d2d64ed&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=15045751&response-content-disposition=attachment%3B%20filename%3Ddocker-compose-linux-x86_64&response-content-type=application%2Foctet-stream
Connecting to 192.168.2.222:7890... connected.
Proxy request sent, awaiting response... 200 OK
Length: 44920832 (43M) [application/octet-stream]
Saving to: 'docker-compose-linux-x86_64'

docker-compose-linux-x86_ 100%[==================================>]  42.84M  22.4MB/s    in 1.9s

2023-12-08 19:26:25 (22.4 MB/s) - 'docker-compose-linux-x86_64' saved [44920832/44920832]

root@NAS:~#
root@NAS:~# mv docker-compose-linux-x86_64 /usr/local/bin/docker-compose  # 移动拉取好的文件到对应位置
root@NAS:~# chmod 777 /usr/local/bin/docker-compose  # 授权文件读写权限为everyone
root@NAS:~# docker-compose  # 验证dokcer-compose命令

Usage:  docker compose [OPTIONS] COMMAND

Docker Compose

Options:
      --ansi string                Control when to print ANSI control characters
                                   ("never"|"always"|"auto") (default "auto")
      --compatibility              Run compose in backward compatibility mode
      --env-file string            Specify an alternate environment file.
  -f, --file stringArray           Compose configuration files
      --parallel int               Control max parallelism, -1 for unlimited (default -1)
      --profile stringArray        Specify a profile to enable
      --project-directory string   Specify an alternate working directory
                                   (default: the path of the, first specified, Compose file)
  -p, --project-name string        Project name

Commands:
  build       Build or rebuild services
  convert     Converts the compose file to platform's canonical format
  cp          Copy files/folders between a service container and the local filesystem
  create      Creates containers for a service.
  down        Stop and remove containers, networks
  events      Receive real time events from containers.
  exec        Execute a command in a running container.
  images      List images used by the created containers
  kill        Force stop service containers.
  logs        View output from containers
  ls          List running compose projects
  pause       Pause services
  port        Print the public port for a port binding.
  ps          List containers
  pull        Pull service images
  push        Push service images
  restart     Restart service containers
  rm          Removes stopped service containers
  run         Run a one-off command on a service.
  start       Start services
  stop        Stop services
  top         Display the running processes
  unpause     Unpause services
  up          Create and start containers
  version     Show the Docker Compose version information

Run 'docker compose COMMAND --help' for more information on a command.
root@NAS:~#

功德+1(狗子).gif

👇👇👇