简体   繁体   English

从Node.js将dockerfile字符串插入`docker build`无法正常工作

[英]Piping a dockerfile string to `docker build` from Node.js is not working

I am trying to pipe a Dockerfile to docker build via stdin as mentioned here: 我正在尝试通过stdin将Dockerfile通过管道传递到Docker docker build ,如下所述:

https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f

I have tried everything, and Docker just doesn't seem to accept the my stdin. 我已经尝试了一切,而Docker似乎似乎并没有接受我的标准输入。

const dockerfileStr = 'FROM alpine-node'
const child = spawn('docker build . -f -', {shell:true, stdio: ['pipe', 'inherit']})
child.stdin.write(dockerfileStr + '\n')
child.stdin.end()

Maybe it expects a tty ? 也许它期望tty

The PR that added this request is here: https://github.com/moby/moby/pull/31236/files 添加此请求的PR在这里: https : //github.com/moby/moby/pull/31236/files

So it turns out it was just being slow because my build context was massive. 事实证明,这只是缓慢,因为我的构建环境非常庞大。 And it didn't seem to report status... 而且它似乎没有报告状态...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM