我正在尝试从一个可以执行一些terraform代码的剧本中创建一个容器,但是一旦容器被创建,我要求它的第一个命令apt update就会在exit /bin/bash: line 1: apt update && apt install -y build-essential && bundle install && terraspace check_setup && terraspace up rds -y: command not found上给出错误消息。最奇怪的是,它过去运行良好,但是自从我们从ansible 2.10.X更新到ansible 2.12.8之后,这个错误就出现了。下面是用于创建容器的代码:
- name: Launch Docker container with Terraspace image
register: container_terraspace_apply_result
community.docker.docker_container:
name: "terraspace-test"
image: a-private-ubuntu-base-terraform-image
working_dir: /opt/terraform
volumes:
- "/home/terraform:/opt/terraform:rw"
- "/home/.aws:/root/.aws:ro"
command_handling: correct
entrypoint: ["/bin/bash"]
command: [
"-l",
"-c",
"'apt update && apt install -y build-essential && bundle install && terraspace check_setup && terraspace up rds -y'"
]
env:
REGION: "eu-west-1"
AWS_REGION: "eu-west-1"
TS_ENV: "staging"
AWS_PROFILE: "terraform-staging"我发现,如果我只做"'apt'",我就会得到aptr帮助输出,当输入它时没有参数,所以二进制路径是好的,唯一的问题似乎是后面的空间?
这里有什么东西我遗漏了吗?我四处张望,找不到解决问题的办法。
谢谢!
发布于 2022-09-01 09:56:39
原来是command_handling选项,需要设置为compatibility!
https://stackoverflow.com/questions/73567164
复制相似问题