- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在执行相同的 docker-compose build
命令,我看到它错过了缓存
Building service1
Step 1/31 : FROM node:10 as build-stage
---> a7366e5a78b2
Step 2/31 : WORKDIR /app
---> Using cache
---> 8a744e522376
Step 3/31 : COPY package.json yarn.lock ./
---> Using cache
---> 66c9bb64a364
Step 4/31 : RUN yarn install --production
---> Running in 707365c332e7
yarn install v1.21.1
..
..
..
最佳答案
how can I generally debug a problem of this kind. How can I know WHY docker-compose thinks things changed (although I'm pretty sure NOTHING changed), which files/commands/results are different
I'm a bit bummed that I can't seem to find any way to make the Docker build more verbose
moby/moby
issue 30081解释 (by
Sebastiaan van Stijn ( thaJeztah
) :
Current versions of
docker-compose
anddocker build
in many (or all) cases will not share the build cache, or at least not produce the same digest.The reason for that is that when sending the build context with
docker-compose
, it will use a slightly different compression (docker-compose
is written in Python, whereas thedocker
cli is written in Go).
There may be other differences due to them being a different implementation (and language).
The next release of
docker compose
will have an (currently opt-in) feature to make it use the actualdocker
cli to perform the build (by setting aCOMPOSE_DOCKER_CLI_BUILD=1
environment variable). This was implemented in docker/compose#6865 (1.25.0-rc3+, Oct. 2019)With that feature, docker compose can also use BuildKit for building images (setting the
DOCKER_BUILDKIT=1
environment variable).
I would highly recommend using buildkit for your builds if possible.
When using BuildKit (requires Docker 18.09 or up, and at this point is not supported for building Windows containers), you will see a huge improvement in build-speed, and the duration taken to send the build-context to the daemon in repeated builds (buildkit uses an interactive session to send only those files that are needed during build, instead of uploading the entire build context).
COMPOSE_DOCKER_CLI_BUILD=1 DOCKER_BUILDKIT=1 docker-compose build
塞巴斯蒂安加入
issue 4012 :
BuildKit is still opt-in (because there's no Windows support yet), but is production quality, and can be used as the default for building Linux images.
Finally, I realize that for the Azure pipelines, you (probably) don't have control over the versions of Docker and Docker Compose installed, but for your local machines, make sure to update to the latest 19.03 patch release; for example, Docker 19.03.3 and up have various improvements and fixes in the caching mechanisms of BuildKit (see, e.g., docker#373).
You wouldn't mount the Yarn cache directory. Instead, you should make sure you take advantage of Docker's image layer caching.
These are the commands I am using:
COPY package.json yarn.lock ./
RUN yarn --pure-lockfile
然后试试你的
yarn install
命令,看看 docker 是否仍然不使用它的缓存。
RUN yarn install --frozen-lockfile --production && yarn cache clean
别忘了
yarn cache clean
为了
prevent the yarn cache from winding up in docker layers .
buildctl build --progress=plain
查看更详细的输出,并调试缓存情况。
FROM node:alpine
WORKDIR /usr/src/app
COPY . /usr/src/app/
# We don't need to do this cache clean, I guess it wastes time / saves space: https://github.com/yarnpkg/rfcs/pull/53
RUN set -ex; \
yarn install --frozen-lockfile --production; \
yarn cache clean; \
yarn run build
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
COPY --from=0 /usr/src/app/build/ /usr/share/nginx/html
关于docker - 构建时如何调试 docker-compose 缓存未命中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60384483/
我使用以下命令使用 Composer 删除了一个包。 composer remove sjparkinson/static-review 以上命令从 composer.json 中删除条目文件但 co
我刚刚开始使用 Composer 功能,你告诉它查看本地目录的依赖关系,这样你就可以开发一个库和一些并行使用该库的东西,而不必一直推送到 git 来更新,这是惊人的。例如 "repositories"
composer 和有什么区别和 composer.phar ? 例子: composer install composer.phar install 我一直看到使用 composer.phar 编写
阅读docker-compose -h或this official manual的帮助将为我们提供--project-directory PATH选项 docker-compose [-f ...]
我已经使用他们的安装指南在我的 Linux/Apache 服务器上的根目录(这是默认选择)中成功安装了 Composer。到目前为止,一切都非常简单,除了我必须进行的一个 php.ini 调整( de
在我的 composer.json配置文件,我有: "require": { "zendframework/zend-log" : "~2.3", }, "require-dev": {
从 Composer 安装此软件包后,我想复制位于软件包内的一些文件。 实际上,我希望在从 Composer 安装或更新软件包后,将下载的软件包中可能存在的某个文件复制到另一个目录。我用 script
我对码头公司还是个新手。我使用的是最新版本的Python、Django和Docker。我已经在这个项目上工作了两周了,我已经创建了docker-compose.yml文件,并且已经构建了我的docke
我正在尝试使用 composer 安装一个 github 项目并得到以下错误 Composer [UnexpectedValueException]您的 github.com 的 Github oau
我开发 Symfony 包的工作流程如下: 安装 Symfony 为新包创建一个 git repo,在其中放置一个 composer.json 文件 需要顶级 composer.json 中的新包,使
我正在尝试使用 composer 安装 github 项目并收到以下错误 Composer [UnexpectedValueException] 您用于 github.com 的 Github oau
我们在项目中使用了 composer。当我开发和/或向项目提交任何内容时,我通常应该使用 composer install;更新依赖项只是偶尔进行。 我们还使用 https://github.com/
我在 youtube 上学会了这个抽屉 https://www.youtube.com/watch?v=JLICaBEiJS0&list=PLQkwcJG4YTCSpJ2NLhDTHhi6XBNfk9
我知道在 onClick 中调用可组合函数是不可能的。 @Composable 调用只能在 @Composable 函数的上下文中发生 撰写版本 - alpha06 但我坚持以下要求。 要求是, 在
这是我的 docker-compose.yml 文件: version: '3.1' services: a: image: tutum/hello-world b: imag
创建Asset实例时是否有auto_increment字段类型可用。例如, Assets ID 应该是自动生成的字段,应该在运行时创建,而不是在应用程序级别提及该值。我可以通过创建一个交易处理器函数来
在 Composer 项目中,我必须添加一个库,它没有 composer.json 并且不使用命名空间。因此,我调整了项目的 composer.json 以添加库: { [...] "
当 vendor 目录中已经有一些组件被下载时.. 在上面运行 install 以及运行 update 时有什么影响? 最佳答案 所以我有同样的问题,这是我发现的: composer install
尝试运行 composer install 时出现此错误。我已经运行了 composer update,我正在尝试使用这个最新的锁定文件进行安装。没有任何帮助。 Loading composer re
当我尝试做: $ sudo php composer.phar update 我收到此警告: Warning: This development build of composer is over 3
我是一名优秀的程序员,十分优秀!