Closed jf647 closed 10 years ago
What knife container docker build --force
is intended to do is pass force down to things like Berkshelf. What you're looking for will be called knife container docker rebuild
and should be out in the very near future. The process that docker rebuild
will automate is retagging your base image (i.e. chef/ubuntu-12.04
) as the image name, deleting your headless image and then rerunning knife container docker build
. Does this make sense?
That makes perfect sense. I saw that there were updates to things like chef-init in master vs the one in the base image (e.g. --verify), so I figured things might still be in flux. Thanks.
While the rebuild
option is not there yet, can I mimick this by changing my FROM
image to chef/buntu-12.04:latest
in the Dockerfile? I would like to have a clean build every time build this image on my CI server.
Yes - that is the way to do it if you want to converge from a fresh image every single time.
I'm a bit confused about how knife-container uses tags when rebuilding images. Here's my use case:
The issue seems to be that the Dockerfile created starts "FROM foo", which makes sense the first time but not the second. I want to throw out what I had build incorrectly and start over from chef/ubuntu-12.04, not iterate on top of a (possibly) broken image.
Given that the first command in the generated Dockerfile is ADD, there is zero chance of getting a cache hit on re-builds, so it seems like we should always start from the base image.
My fix was to move the tag 'foo' back to the same image as chef/ubuntu-12.04 and re-run the build step. This produced the image I wanted in the first place.
Am I missing something? Is --force not meant to be used in this scenario, and if so what should I have done differently? Untagged 'foo', removed the cookbooks folder and start over without --force?