Bash 如何在docker容器中执行expect脚本

Bash 如何在docker容器中执行expect脚本,bash,docker,expect,Bash,Docker,Expect,我想在docker容器中运行一个expect脚本。我已将该文件命名为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 - ta

我想在docker容器中运行一个expect脚本。我已将该文件命名为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容器执行expect脚本的方法。是否有图像支持这一点?我是docker的新手,因此非常感谢您的帮助

我使用expect脚本在我的16.04 Ubuntu容器中安装了一个需要用户提示的程序。确保安装expect二进制文件,它不包括在内。下面是它的样子:

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>

#安装yocto依赖项
运行apt-get-update&&apt-get-y安装gawk wget-git-core-diffstat解压texinfo-gcc-multilib\
构建基本chrpath socat cpio python3 python3 pip python3 pexpect\
xz utils debianutils iputils ping python3 git python3-jinja2 libegl1 mesa libsdl1.2-dev\
xterm repo预期区域设置
#安装
运行/home/docker/scripts/install.exp
install.exp:

#!/usr/bin/expect

set timeout -1

<snip>
#/usr/bin/expect
设置超时-1

既然您说“#!/usr/bin/env bash”正在工作,为什么不制作一个调用expect脚本的bash脚本呢?