Bar*_*baz 2 caching apt docker
我有以下 dockerfile:
\nFROM debian:buster\n\n#Configure apt to look at my Debian repository\nCOPY ./apt /etc/apt\n\n#Install the software into the image\n\nRUN apt-get update && apt-get -V -y dist-upgrade && apt-get -V -y --allow-unauthenticated --no-install-recommends --allow-downgrades install -f business=1.1-0\n\nENTRYPOINT ["/usr/sbin/main.sh"]\nCMD []\nRun Code Online (Sandbox Code Playgroud)\n所以基本上它从版本 1.1-0 安装包 \xe2\x80\x9cbusiness\xe2\x80\x9d\n我的 docker 缓存有问题,我\xe2\x80\x99m 推送包 \xe2\x80\ 的新代码更改x9cbusiness\xe2\x80\x9d 具有相同版本 (1.1-0) [是的,我\xe2\x80\x99m 覆盖版本\xe2\x80\xa6] 并且 docker 缓存不够智能,无法提取新更改的 .deb。
\n它使用缓存层而无需更改代码:皱眉:\n作为解决方法,我使用 --no-cache 进行构建,但我不喜欢这个解决方案,因为我失去了缓存机制。
\n有办法解决吗?我可以仅从特定层构建而不使用缓存吗?
\n小智 5
是的你可以,
选项a)
RUN apt-get update && apt-get -V -y dist-upgrade
RUN head -c 23 /dev/urandom > /.randfile && apt-get -V -y --allow-unauthenticated --no-install-recommends --allow-downgrades install -f business=1.1-0
Run Code Online (Sandbox Code Playgroud)
选项b)
--no-cache选项生成第二个映像
(例如,在第一个管道中进行升级,作为 someimage:baseimage 推送,然后在下一阶段使用docker-composedocker buildFROM someimage:baseimage选项c)
| 归档时间: |
|
| 查看次数: |
225 次 |
| 最近记录: |