在基于Alpine Docker的Image下运行gitlab-ci.yml脚本时出错

所以,我需要使用Gitlab CI运行部署作业时运行ssh。 我使用https://hub.docker.com/r/nmfzone/ssh-client-light/ docker映像。

但是,我不能。 因为这个错误被抛出。

 Checking out 32af65e1 as development... Skipping Git submodules setup Unknown cipher type 'if [ -x /usr/local/bin/bash ]; then exec /usr/local/bin/bash elif [ -x /usr/bin/bash ]; then exec /usr/bin/bash elif [ -x /bin/bash ]; then exec /bin/bash elif [ -x /usr/local/bin/sh ]; then exec /usr/local/bin/sh elif [ -x /usr/bin/sh ]; then exec /usr/bin/sh elif [ -x /bin/sh ]; then exec /bin/sh else echo shell not found exit 1 fi 

我如何解决它?

在构buildhttps://hub.docker.com/r/nmfzone/ssh-client-light/图像时,我在Dockerfile中使用了此configuration。

 FROM gliderlabs/alpine:3.4 RUN apk update && \ apk add --update bash && \ apk add openssh-client # Security fix for CVE-2016-0777 and CVE-2016-0778 RUN echo -e 'Host *\nUseRoaming no' >> /etc/ssh/ssh_config ENTRYPOINT ["ssh"] 

要么使用gitlab的ssh执行程序,要么将docker的入口点改为合适的shell,并在脚本中运行ssh。 Gitlab的docker runner不支持不是shell的入口点。

对于有这个问题的人,如果你已经安装了bash shell,你需要在你的Dockerfile中这样的东西。

 ENTRYPOINT ["/bin/bash", "-c"]