CPU架构ARM64 - 鲲鹏920
操作系统CentOS8.3

说明

通常,当我们在运行docker-compose的时候,我们在后台使用的是x86_64 CPU处理器指令集。如果我们尝试按照默认的安装说明在运行在arm64上的系统上安装docker compose,就会出现错误。这是因为没有可用于arm64指令集的docker compose二进制文件。

安装docker-compose1(验证失败)

官方的安装方式


# sudo curl -L --fail https://github.com/docker/compose/releases/download/1.29.2/run.sh -o /usr/local/bin/docker-compose

# sudo chmod +x /usr/local/bin/docker-compose

# docker-compose

事实证明不行,报错。

采用编译安装

[root@kunpeng-centos ~]# curl -L --fail https://github.com/docker/compose/releases/download/1.29.2/run.sh -o /usr/local/bin/docker-compose
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   612  100   612    0     0    371      0  0:00:01  0:00:01 --:--:--   371
100  2585  100  2585    0     0    973      0  0:00:02  0:00:02 --:--:--  6053
[root@kunpeng-centos ~]# sudo chmod +x /usr/local/bin/docker-compose
[root@kunpeng-centos ~]# docker-compose 
Unable to find image 'docker/compose:1.29.2' locally
1.29.2: Pulling from docker/compose
339de151aab4: Pull complete 
484a7070e879: Pull complete 
6391cb0e5266: Pull complete 
aaaf585806ed: Pull complete 
Digest: sha256:ae66070588c539b965986dc74e9371e3e62ef71668b72a5eed70de111ed3659e
Status: Downloaded newer image for docker/compose:1.29.2
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error
[root@kunpeng-centos ~]# 
[root@kunpeng-centos ~]# docker-compose 
WARNING: The requested image's platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
standard_init_linux.go:228: exec user process caused: exec format error
[root@kunpeng-centos ~]# 

看错误信息,安装失败。

安装方式2 (验证成功)

下载安装二进制文件

下载地址:

https://download.csdn.net/download/somken/22031276

安装过程

[root@kunpeng-centos ~]# tar xf docker-compose-linux-arm64-1.25.0.tgz -C /usr/local/bin/
[root@kunpeng-centos ~]# ls -a /usr/local/bin/
.  ..  docker-compose-linux-arm64-1.25.0
[root@kunpeng-centos ~]# ln -s /usr/local/bin/docker-compose-linux-arm64-1.25.0 /usr/local/bin/docker-compose
[root@kunpeng-centos ~]# docker-compose version
docker-compose version 1.25.0, build 4038169d
docker-py version: 4.1.0
CPython version: 3.6.5
OpenSSL version: OpenSSL 1.1.0f  25 May 2017
[root@kunpeng-centos ~]# 

验证安装

[root@kunpeng-centos ~]# docker-compose
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f <arg>...] [options] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  -f, --file FILE             Specify an alternate compose file
                              (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name
                              (default: directory name)
  --verbose                   Show more output
  --log-level LEVEL           Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  --no-ansi                   Do not print ANSI control characters
  -v, --version               Print version and exit
  -H, --host HOST             Daemon socket to connect to

  --tls                       Use TLS; implied by --tlsverify
  --tlscacert CA_PATH         Trust certs signed only by this CA
  --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
  --tlskey TLS_KEY_PATH       Path to TLS key file
  --tlsverify                 Use TLS and verify the remote
  --skip-hostname-check       Don't check the daemon's hostname against the
                              name specified in the client certificate
  --project-directory PATH    Specify an alternate working directory
                              (default: the path of the Compose file)
  --compatibility             If set, Compose will attempt to convert keys
                              in v3 files to their non-Swarm equivalent
  --env-file PATH             Specify an alternate environment file

Commands:
  build              Build or rebuild services
  bundle             Generate a Docker bundle from the Compose file
  config             Validate and view the Compose file
  create             Create services
  down               Stop and remove containers, networks, images, and volumes
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  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 services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for 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
[root@kunpeng-centos ~]# 

到此为止,安装成功。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐