[英]How to write a Linux command in a Dockerfile
I have a linux shell command, that need to be written in a Dockerfile. 我有一个Linux shell命令,该命令需要用Dockerfile编写。
for ((i=10001; i<10101; ++i)); do pwgen -n -s -B -c 10 | sed "s/^/$i /"; done > user.tx_ ; /bin/cp -f user.tx_ user.txt ;
Anybody can help me ? 有人可以帮助我吗? Thank you very much. 非常感谢你。
You can use the RUN
keyword in order to execute stuff. 您可以使用RUN
关键字来执行内容。
If it's shell command you want to run, you can run bash -c
with your shecl script. 如果要运行的是shell命令,则可以使用shecl脚本运行bash -c
。
See some examples and doc here:. 在此处查看一些示例和文档: https://docs.docker.com/engine/reference/builder/#run https://docs.docker.com/engine/reference/builder/#run
这可以为您提供一个位于容器内的外壳:
docker exec dockernamehere bash
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.