Skip to content

Add no cache for docker build#1384

Merged
creack merged 2 commits intomoby:masterfrom
crosbymichael:1326-build-without-cache
Aug 2, 2013
Merged

Add no cache for docker build#1384
creack merged 2 commits intomoby:masterfrom
crosbymichael:1326-build-without-cache

Conversation

@crosbymichael
Copy link
Contributor

Add a new flag to disable the image cache when building images.

Closes #1326

Add a new flag to disable the image cache when building images.
@vieux
Copy link
Contributor

vieux commented Aug 2, 2013

LGTM

@creack
Copy link
Contributor

creack commented Aug 2, 2013

LGTM

creack added a commit that referenced this pull request Aug 2, 2013
@creack creack merged commit ead7eb6 into moby:master Aug 2, 2013
@matthewmueller
Copy link
Contributor

<3

@crosbymichael crosbymichael deleted the 1326-build-without-cache branch August 2, 2013 21:41
@mohanraj-r
Copy link

Trying to understand how caching works in general in docker. I understand -no-cache will disable caching for the entire Dockerfile. But how can I disable cache for a specific RUN command? For example updating repos or downloading a remote file .. etc. From my understanding that right now RUN apt-get update if cached wouldn't actually update the repo? This will cause the results to be different than from a VM?

If it is possible to disable caching for specific commands in the Dockerfile, would the subsequent commands in the file then not use the cache? Or would they do something a bit more intelligent - e.g. use cache if the previous command result did not change even if didn't use the cache etc ?

Can someone please explain? @crosbymichael ?

Thanks,

@shykes
Copy link
Contributor

shykes commented Sep 24, 2013

It's not possible to disable caching selectively atm. This is mostly because I can't think of a good way to select the layer to invalidate. Suggestions are welcome :)

One thing you can do is remove the intermediary image used for caching - if you run "docker history" on your most recently built image, you'll see the image IDs corresponding to each build step.


@solomonstre
@getdocker

On Mon, Sep 23, 2013 at 11:09 AM, Mohan Raj Rajamanickam
notifications@github.com wrote:

Trying to understand how caching works in general in docker. I understand -no-cache will disable caching for the entire Dockerfile. But how can I disable cache for a specific RUN command? For example updating repos or downloading a remote file .. etc. From my understanding that right now RUN apt-get update if cached wouldn't actually update the repo? This will cause the results to be different than from a VM?
If it is possible to disable caching for specific commands in the Dockerfile, would the subsequent commands in the file then not use the cache? Or would they do something a bit more intelligent - e.g. use cache if the previous command result did not change even if didn't use the cache etc ?
Can someone please explain? @crosbymichael ?

Thanks,

Reply to this email directly or view it on GitHub:
#1384 (comment)

@mohanraj-r
Copy link

Thanks @shykes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Force clean build of an image (without cache)

6 participants