我正在关注blogpost,将Docker映像从GitLab推送到AWS Fargate。在某个时候,有一个从gitlab-ci.yml调用的shell脚本可以使用aws cli登录。
我一直在尝试解决此问题,在此过程中,我创建了一个非常小的 .gitlab-ci.yml 来重现此问题:
image: docker:latest
stages:
- test
build_test:
stage: test
image:
name: docker:latest
services:
- docker:dind
environment:
name: production
script:
- source script/deploy.sh
shell脚本( script / deploy.sh )为:
#!/bin/sh
echo "preparing python installation"
apk add --update python
echo "python installed"
这会在GitLab上提供以下输出:
[...]
Running on runner-fa6cab46-project-11081405-concurrent-0 via runner-fa6cab46-srm-1551436016-4b73cd2c...
Cloning repository...
Cloning into '/builds/test-repo'...
Checking out 21d6f4dd as master...
Skipping Git submodules setup
$ source script/deploy.sh
/bin/sh: script/deploy.sh: line 2:
: not found
ERROR: Job failed: exit code 127
根据this related question,在Docker最新映像或dind映像中可能没有shell或bash,但是我该如何解决呢?我正在使用公共gitlab运行程序。