Home  >  Q&A  >  body text

docker build 失败退出,如何恢复并接着之前的步骤继续 build

build 的时候有跑系统更新,所以更新了很多文件,结果安装程序的时候写错了一个字母导致命令中断并退出。

重新修改 Dockerfile 后,如何能接着之前退出的部分继续 build 呢?

迷茫迷茫2707 days ago1067

reply all(2)I'll reply

  • 怪我咯

    怪我咯2017-04-24 09:11:43

    Docker's build operation is based on cache by default, that is, after you modify the Dockerfile, the build task will quickly skipyour previous successful steps, and all operations after the step you modified will be re-run.
    If you want each build not to be based on the previous cache, add the --no-cache=true parameter to the build command
    Also see:
    Dockerfile best practices

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-24 09:11:43

    Normally speaking, there is no need to re-run the previous steps when rebuilding. Just 从失败的那条RUN开头的命令开始接着处理;

    It is recommended that you split multiple commands into independent RUN commands; ensure that you do not need to re-run the previous RUN command each time;

    reply
    0
  • Cancelreply