"docker-compose up"表示删除后映像已存在



我试图从头开始,使用"docker-composup"下拉并运行的图像。所以我尝试运行这些 docker 命令来清理:

docker rmi $(docker images -aq)
docker rm $(docker ps -aq) -f
docker system prune --all

但是当我运行docker-compose -f my-yaml-file.yaml时,控制台显示:

Pulling shell <repo info>
1.0: Pulling from <repo info>...
ae79f2514705: Already exists
5ad56d5fc149: Already exists
170e558760e8: Already exists
395460e233f5: Already exists
6f01dc62e444: Already exists
1b19c959c7bd: Pull complete

我省略了上面的私有存储库信息,但想知道为什么它说这些哈希(或任何它们(已经存在。我尝试使用这些命令删除所有内容,但无论我尝试什么,它总是检测到存在某些内容。它正在检测什么以及如何删除它们?我尝试过重新启动码头工人、重新启动等。结果总是一样。

"问题"出在 docker 的缓存中。您要做的是向docker compose build命令添加--no-cache标志,有关更多详细信息,请参阅文档。

我还发现了一个 github 问题,要求--no-cache选项(已经存在(,但在评论中您可以看到干净重建的示例,有人说不需要--force-recreate标志。

docker-compose rm --all &&
docker-compose pull &&
docker-compose build --no-cache &&
docker-compose up -d --force-recreate &&

我希望这有帮助!

最新更新