无法从Docker远程api中的文件提供stdin

时间:2019-10-16 12:06:34

标签: c# docker remoteapi

我正在尝试使用docker Remote API在docker上运行文件,命令看起来像这样:

> python /src/app/stdin/test.py < /src/app/stdin/1.txt >
> /src/app/stdout/1.txt 2> /src/app/stderr/1.txt

但是 stdin,stdout和stderr test.py 无效,它正在系统中等待输入。

您能指出我在做什么吗?

我已经尝试使用attachStdin = False 和 AttachStdin,AttachStdout和AttachStdout的每种组合来创建容器/ EXEC。

POST /containers/20a142da85b9/exec HTTP/1.11
User-Agent: Docker.DotNet
Host: localhost:2375
Connection: close
Content-Type: application/json; charset=utf-8
Content-Length: 391

{"Privileged":true,"Tty":true,"AttachStdin":true,"AttachStderr":true,"AttachStdout":true,"Cmd":["python","/src/app/Folder_7c9739e4x7ee6x40d1xb56exb136d4333b0a/stdin/test.py","<","/src/app/Folder_7c9739e4x7ee6x40d1xb56exb136d4333b0a/stdin/1.txt",">","/src/app/Folder_7c9739e4x7ee6x40d1xb56exb136d4333b0a/stdout/1.txt","2>","/src/app/Folder_7c9739e4x7ee6x40d1xb56exb136d4333b0a/stderr/1.txt"]}HTTP/1.1 201 Created
Api-Version: 1.40
Content-Length: 74
Content-Type: application/json
Date: Wed, 16 Oct 2019 09:42:35 GMT
Docker-Experimental: false
Ostype: linux
Server: Docker/19.03.2 (linux)
Connection: close

{"Id":"457fdcaf26280082edefff53d0098e7c7645b22e7e5e3cb073a055a90fd80c37"}


POST /exec/457fdcaf26280082edefff53d0098e7c7645b22e7e5e3cb073a055a90fd80c37/start HTTP/1.11
User-Agent: Docker.DotNet
Host: localhost:2375
Connection: close
Content-Type: application/json; charset=utf-8
Content-Length: 60

{"AttachStdin":true,"AttachStderr":true,"AttachStdout":true}HTTP/1.1 200 OK
Api-Version: 1.40
Content-Type: application/vnd.docker.raw-stream
Docker-Experimental: false
Ostype: linux
Server: Docker/19.03.2 (linux)
Transfer-Encoding: identity
Date: Wed, 16 Oct 2019 09:43:47 GMT
Connection: close

0 个答案:

没有答案