Giter VIP home page Giter VIP logo

Comments (12)

bjaglin avatar bjaglin commented on May 20, 2024

I am guessing this comes from the fact that in docker, pulling an image pulls all tags by default, while running it pulls/runs the :latest by convention. So I would recommend always explicitly defining a tag, even if that's :latest in your crane.yaml.

To avoid that in the future, we could either enforce the presence of a tag, or append :latest if it's not explicitly given. I'd go for the first option as the implicit default tag is good enough for quickly starting containers from the command line with docker, but brings some confusion/inconsistencies such as the one you are facing, and is not really a substantial time win when the image is defined in a static file anyway.

from crane.

phuongnd08 avatar phuongnd08 commented on May 20, 2024

I just added :latest and it is still pulling new layers. I noticed that I use postgres:9.3 before and it was pulling every provision as well.

from crane.

bjaglin avatar bjaglin commented on May 20, 2024

Then the behavior is correct then? The tag was updated remotely, so either crane provision or docker pull will download the layers introduced with the update so that the local tag is reflecting that (docker history would show that). Either stick to an image where tags are effectively immutable/stable on the remote registry, or don't explicitly re-provision. Or maybe I am misunderstanding your workflow?

from crane.

phuongnd08 avatar phuongnd08 commented on May 20, 2024

For example, if you have a Dockerfile like this:

FROM dockerfile/redis

And run docker build ., docker will only pull the image the very first time. From second time it will get the image from the cache.

If I declare a container in crane.yml without specify the dockerfile, crane will tell docker to pull the image every time it provision. I'd rather go with docker behavior: only pull if the image cannot be found in local cache. I think crane should check with docker images for non-existence before telling docker to pull the image. We can have a --refresh to force the pull though.

from crane.

michaelsauter avatar michaelsauter commented on May 20, 2024

I agree that lift should check if the image exists already and not do any work that is not absolutely needed. After all, it's just a convenience shortcut. provision however should default to standard build/pull behaviour in my eyes.

from crane.

bjaglin avatar bjaglin commented on May 20, 2024

Not sure I agree here - currently lift has provision && run semantics, and I think it's a great way to say "run the latest version" (it's the most used command amongs our devs). If you want to run containers from your local cache (or pull if not present), then you can simply use run. I guess the only issue here is what to do with base images when a container provides a Dockerfile in the config.

from crane.

michaelsauter avatar michaelsauter commented on May 20, 2024

@phuongnd08 Does using runinstead of liftas suggested by @bjaglin work for you?

from crane.

phuongnd08 avatar phuongnd08 commented on May 20, 2024

run doesn't do provision so if the Dockerfile changed, the new container won't be rebuilt so I don't think it's the solution here. Though I think this can be closed as using one line Dockerfile works for me.

from crane.

iverberk avatar iverberk commented on May 20, 2024

I must say that I agree with @phuongnd08 about checking the cache before pulling the image. I specify an image in the crane file. The image is built locally with Packer and the current implementation of lift forces me to push the new image to the registry before it can be used. I'd rather have Crane pick-up the (newer) image from local cache so that I can significantly shorten my image development cycle.

I guess the default behavior doesn't need to change but it needs to be made configurable, either by providing a --refresh (pull from registry) or --cache (try to find local image first) flag. If we can work out the details here then I'd be willing to create a pull-request.

from crane.

tpaz avatar tpaz commented on May 20, 2024

+1 --cache flag to prefer local image over reigstry

from crane.

michaelsauter avatar michaelsauter commented on May 20, 2024

@phuongnd08 @iverberk @tpaz Do you guys use lift -r or just lift?
I'm wondering whether lift should prefer local images, and lift -r update to the latest possible image. Not sure though. I'm not against a --cache/local flag, maybe that's the best option.

from crane.

michaelsauter avatar michaelsauter commented on May 20, 2024

Closing since building images and the behaviour of lift might change with #195.

from crane.

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.