-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reuse Docker layers #544
Comments
Thanks for this report. I can confirm this. There are two reasons why we see this. One is artifacts, other are modules. Below is a snippet from a Dockerfile. FROM centos:7
USER root
RUN yum --setopt=tsflags=nodocs install -y centos-release-scl
# Add scripts used to configure the image
COPY modules /tmp/scripts/
# Add all artifacts to the /tmp/artifacts directory
COPY \
hawkular-javaagent-1.0.1.Final-redhat-2-shaded.jar \
jolokia-jvm-1.5.0.redhat-1-agent.jar \
jmx_prometheus_javaagent-0.3.1.redhat-00006.jar \
/tmp/artifacts/
# begin jboss.container.user:1.0
# Install required RPMs and ensure that the packages were installed
USER root
RUN yum --setopt=tsflags=nodocs install -y unzip tar rsync shadow-utils \
&& rpm -q unzip tar rsync shadow-utils The problem is in the two This is NOT how it should be. We should only rebuild modules that were changed as mentioned in the report. |
Let's try to schedule this for 3.3. |
Small update. Copying modules in the place where we are covering it is easy and I have it already working locally. While testing this change I found that it may be problematic to use caching properly, because the squash post-processing of the image removes every intermediate layer resulting in a fresh build all the time. We have a few options here:
My comments:
So, my suggestion is to go with option two: update documentation to use Besides this, the last part to properly implement this ticket is to copy artifacts only when required, same as modules. Work on this wasn't started yet. |
@goldmann I am fine to not squash dev image. |
Sneak peek:
|
This chnges the way we generate Dockerfile so that artifacts and modules are not copied at the beginning of the Dockerfile. This makes it possible to reuse Docker (and other builder's) cache for content that was not changed. To make use of rapid development with cached you need to make sure the module you modify is installed later in the process because this invalidates cache and all modules installed later will need to be executed again. If you use Docker builder, use the `--no-squash` option. Without this, the squash post processing will remove all intermediate container images created at the original image build time removing the cache at the same time. Fixes cekit#544
This chnges the way we generate Dockerfile so that artifacts and modules are not copied at the beginning of the Dockerfile. This makes it possible to reuse Docker (and other builder's) cache for content that was not changed. To make use of rapid development with cached you need to make sure the module you modify is installed later in the process because this invalidates cache and all modules installed later will need to be executed again. If you use Docker builder, use the `--no-squash` option. Without this, the squash post processing will remove all intermediate container images created at the original image build time removing the cache at the same time. Fixes cekit#544
This chnges the way we generate Dockerfile so that artifacts and modules are not copied at the beginning of the Dockerfile. This makes it possible to reuse Docker (and other builder's) cache for content that was not changed. To make use of rapid development with cached you need to make sure the module you modify is installed later in the process because this invalidates cache and all modules installed later will need to be executed again. If you use Docker builder, use the `--no-squash` option. Without this, the squash post processing will remove all intermediate container images created at the original image build time removing the cache at the same time. Fixes #544
I would like to only rebuild starting from the module I modified. As an example:
https://github.com/wildfly/wildfly-s2i/blob/master/wildfly-builder-image/image.yaml
If I have:
from X
install
module1
module2
module3
Any change to module3 should only rebuild the image starting from module3.
Today we are rebuilding all.
The text was updated successfully, but these errors were encountered: