我有一个期望脚本,希望在docker容器中运行。我已将文件命名为exp扩展名,并将其称为filename.exp。我正在使用Ubuntu docker映像。看起来容器以#!/ usr / bin / env bash开头而不是#!/ usr / bin / expect
开头时能够识别文件pipeline.yml文件
jobs:
- name: job-pass-files
public: true
plan:
- get: resource-tutorial
- task: create-some-files
config:
platform: linux
image_resource:
type: docker-image
source: {repository: ubuntu}
inputs:
- name: resource-tutorial
run:
path: resource-tutorial/filename.exp
filename.exp
#!/usr/bin/expect
eval spawn ssh -oStrictHostKeyChecking=no -oCheckHostIP=no user@****
#use correct prompt
set prompt ":|#|\\\$"
interact -o -nobuffer -re $prompt return
send "Password\r"
interact
在大厅执行作业时出现以下错误
Backend error: Exit status: 500, message: {"Type":"","Message":"runc exec: exit status 1: exec failed: container_linux.go:348: starting container process caused \"no such file or directory\"\n","Handle":"","ProcessID":"","Binary":""}
是否有一种方法可以从Docker容器执行期望脚本。有支持它的图像吗?我是Docker的新手,因此非常感谢您的帮助
答案 0 :(得分:0)
我使用Expect脚本在我的16.04 Ubuntu容器之一中安装需要用户提示的程序。确保安装期望的二进制文件,它不包含在内。看起来是这样的:
Dockerfile:
<snip>
#Install yocto dependencies
RUN apt-get update && apt-get -y install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping python3-git python3-jinja2 libegl1-mesa libsdl1.2-dev \
xterm repo expect locales
# Install
RUN /home/docker/scripts/install.exp
<snip>
install.exp:
#!/usr/bin/expect
set timeout -1
<snip>