将文件配置到码头运行 [英] Piping a file into docker run
本文介绍了将文件配置到码头运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经尝试过了。
cat data.txt | docker run -a stdin -a stdout -i -t ubuntu / bin / bash -c'cat> /data.txt'
但似乎无法让它工作。
解决方案
cat setup.json |码头运行-i ubuntu / bin / bash -c'cat'
这对我有用。删除-t。不需要-a的。
I need to pipe (inject) a file or some data into docker as part of the run command and have it written to a file within the container as part of the startup. Is there best practise way to do this ?
I've tried this.
cat data.txt | docker run -a stdin -a stdout -i -t ubuntu /bin/bash -c 'cat >/data.txt'
But can't seem to get it to work.
解决方案
cat setup.json | docker run -i ubuntu /bin/bash -c 'cat'
This worked for me. Remove the -t. Don't need the -a's either.
这篇关于将文件配置到码头运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文