docker-compose - docker-compose up 在哪里保存它的图像?
问题描述
我知道如果我更改我的Dockerfile
或构建目录,我应该运行docker-compose build
. 这肯定意味着 docker-compose 在其已经构建的图像的某处有一些缓存。
它在哪里?我该如何清除它?
我想回到docker-compose up
被迫执行初始构建步骤的状态,而我不需要记住运行docker-compose build
.
我已经运行docker stop $(docker ps -aq)
和docker X prune
(对于容器、图像、卷、网络中的 X),但docker-compose up
仍然拒绝在我的Dockerfile
.
还是我完全误解了 docker-compose 的工作原理?
解决方案
您可以传递其他参数(--no-cache)以在构建过程中跳过使用缓存。
docker@default:~$ docker-compose build --help
Build or rebuild services.
Services are built once and then tagged as `project_service`,
e.g. `composetest_db`. If you change a service's `Dockerfile` or the
contents of its build directory, you can run `docker-compose build` to rebuild it.
Usage: build [options] [--build-arg key=val...] [SERVICE...]
Options:
--compress Compress the build context using gzip.
--force-rm Always remove intermediate containers.
--no-cache Do not use cache when building the image.
--pull Always attempt to pull a newer version of the image.
-m, --memory MEM Sets memory limit for the build container.
--build-arg key=val Set build-time variables for services.
docker@default:~$
推荐阅读
- angular - 与使用管道读取值相比,角度模板中的硬编码对象属性在浏览器中的性能是否更好
- php - 致命错误:未捕获错误:调用未定义函数 mysql_close()
- asynchronous - Chai 测试 .then 内部抛出的错误
- angular - 滚动到顶部时进度条动画的问题
- python - 如何将 numpy.ndarray 作为元数据包含在 boto3 中?
- sql - 如何生成 2 级循环
- arrays - 检查二维数组是升序还是降序排序
- c++ - 解析文件以将变量分配给结构。C++
- hibernate - 如何从java中查询/调用hibernate的@JoinTable注解
- algorithm - 2D 网格形状周围的周长