Dockerfile 中使用 echo 创建文件

2,488 阅读1分钟

编写 Dockerfile 时,有时候需要向文件中插入内容,可以直接在里面通过 echo 命令写入

RUN echo $'\n\
********** \n\
***1234*** \n\
********** ' >> /tmp/file

参考:stackoverflow-How to output a multiline string in Dockerfile with a single command