Giter Club home page Giter Club logo

Comments (10)

bflad avatar bflad commented on July 17, 2024

Honestly, I think this is related to #56. Without build building every run, you'd have to do something like you suggested with the image. A notifies :build won't help in the Git resource either.

from docker.

jayofdoom avatar jayofdoom commented on July 17, 2024

@bflad I'm sure #56 is part of the path to fixing this; but somewhere in there you'd still need to create a new container against the new image, right?

Just trying to figure out how to make all the pieces fit together, and if there's something we can do in the cookbook at a higher level to make it easier (i.e. automatically removing and recreating a container if the underlying image has been updated and a flag is set on the container)

from docker.

bflad avatar bflad commented on July 17, 2024

Thinking out loud, I'd imagine you'd be able to add a notifies [:kill, :remove, :run], 'docker_container[software-container], :immediately' to your docker_image resource (when it actually can build repeatedly).

Seeing that notifies of three actions makes me want to just have a shorthand one like :redeploy or something...

from docker.

jayofdoom avatar jayofdoom commented on July 17, 2024

Yeah, that's what I'm saying. There seems like a shortcut should exist that doesn't currently. And if we added a redeploy, we could make it so something like a docker stop; wait $timeout, then docker kill if it hasn't died, remove the container, and recreate it.

Along with this, something like a docker_container_cleanup and docker_image_cleanup LWRP would be helpful for ensuring you don't end up with 200 old images and containers.

WDYT?

from docker.

bflad avatar bflad commented on July 17, 2024

Sorry, the docker stop command already does that stop, wait for timeout, kill sequence you mentioned. Meant to say :stop, :remove, :run above.

I'm not sure the cookbook should manage extraneous images/containers in your environment. I'd think that's a non-trivial operation. It'd likely have to be a library method that loads all the known Chef docker_image/docker_container resources and removes objects that aren't in that list.

from docker.

jayofdoom avatar jayofdoom commented on July 17, 2024

@bflad I guess my concern is that if you're rebuilding images, the chef cookbook itself is creating extraaneous images -- the ones you're replacing with a new build, the intermediate images that may need to be created by extra builds, etc.

For instance, in my example (admittedly, building on the host is not the best workflow though), if I run chef twice a day, and both times it had an update to the repo which triggers a rebuild, and the first command in the dockerfile is "add . /data/myapp", then in 5 days time, I could have twenty or thirty old, intermediate images. My concern would be to ensure those got cleaned up occasionally, although I do agree that a blanket cleanup is probably a little too dangerous for the cookbook, on further reflection.

from docker.

jayofdoom avatar jayofdoom commented on July 17, 2024

I'm going to add :redeploy today. Hopefully #56 can get fixed up soon too then this workflow will be great.

from docker.

bflad avatar bflad commented on July 17, 2024

Didn't see any commits to your repo, so went ahead and implemented it myself. Will be released in 0.30.0 later tonight. Not going to close this out until #56 happens.

from docker.

bflad avatar bflad commented on July 17, 2024

build action was changed in 0.30.0 as well. I'm going to close this issue, but we should create another one if anyone feels strongly towards handling extraneous builds.

from docker.

jayofdoom avatar jayofdoom commented on July 17, 2024

Thanks, I had implemented this but was finishing up the docs and didn't get it pushed.

from docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.