问题库 Linux / Docker how-to

Docker build 缓存不更新怎么办

快速答案

确认 Dockerfile 层顺序,必要时用 --no-cache 强制重建。

bash
docker build --no-cache -t my-app .

使用要点

  • 先分清容器、镜像、卷和 Compose 服务名,避免对错对象执行命令。
  • 删除、重建或清理资源前,先确认数据是否在卷或挂载目录里。

相关内容