我创建了一个EC2实例并在其上安装了docker,现在我需要使用SSM docker-compose
安装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