我创建了一个 EC2 实例并在其上安装了 docker,现在我需要docker-compose
使用 SSM进行安装send-command
,为此我正在运行以下命令:
aws ssm send-command --instance-ids "${INSTACES_ID}" \
--document-name "AWS-RunShellScript" \
--parameters "commands=[
sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose,
sudo mv /usr/local/bin/docker-compose /usr/bin/docker-compose,
sudo chmod +x /usr/bin/docker-compose,
docker-compose --version
]"
命令正确执行,但命令docker-compose --version
引发以下异常
"StandardErrorContent": "... /usr/bin/docker-compose: cannot execute binary file\nfailed to run commands: exit status 126"
我通过ssh进入EC2问题是一样的,我也尝试将所有权限授予bin文件
$ ls -la /usr/bin | grep docker-compose
-rwxrwxrwx 1 ec2-user ec2-user 6204149 27 set 15.10 docker-compose
$ docker-compose --version
-bash: /usr/bin/docker-compose: cannot execute binary file