且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何更快地构建Docker映像

更新时间:2022-11-03 10:39:18

Docker尽可能使用缓存层进行构建。通过添加已更改的文件,它将使所有后续规则的缓存无效。首先输入apt命令,这些命令仅在您第一次构建时运行。有关更多信息,请参见此博客

Docker builds using cached layers if it can. By adding files you have changed it invalidates the cache for all subsequent rules. Put the apt commands first and those will only be run the first time you build. See this blog for more info.