Giter Club home page Giter Club logo

Comments (7)

ryandub avatar ryandub commented on August 15, 2024

I started a first pass at updating the container provider to do this here, but have run into some snags getting all the tests to pass.

So far my pace has been slow, so I'm posting this here in case anyone else is working on this - maybe they can use some of the work I have already done.

from docker.

bflad avatar bflad commented on August 15, 2024

How are we feeling about this approach @jcrobak / @ryandub?

from docker.

tduffield avatar tduffield commented on August 15, 2024

Something to consider is how to manage the mapping of attributes to API values. Instead of having LWRP attributes for every API value, if we just let people pass in the same objects they would use in the API it would make things a lot easier because then the LWRP would not be tied to a specific version of Docker / Docker API.

I think we can/should keep common options like image, command, name, etc but some of the more complex attributes I think would be better served being passed in through an options parameter.

from docker.

tduffield avatar tduffield commented on August 15, 2024

It would also make managing the state of the containers so much easier since we could just compare json objects instead of inspecting each value one-by-one.

from docker.

bflad avatar bflad commented on August 15, 2024

@tduffield I spent a little time thinking about this. I'll think out loud here, but definitely would appreciate feedback and guidance!

In reference to not having LWRP attribute mappings for all CLI behavior:

  • Having the attributes available allows us to abstract away the underlying Docker implementation, whether we're talking to CLI or API as well as any syntax changes in either case
  • There's nothing currently forcing you to use a specific Docker CLI/API version unless there's a new CLI argument that's not yet available in the cookbook or newer Docker requires a different CLI syntax
    • One thing we can do for "missing" attributes is add a generic "catch all" attribute such as additional_args (CLI) or additional_json (API) for these scenarios
    • If there is removed functionality in Docker, it just requires removing those attributes from your cookbook (you'd have to update your workflow for the updated CLI/API version anyways)
    • As mentioned in #142, if we want to support the syntax nuances between Docker versions, I'm open to a PR with a clean implementation (regardless this would be required for both CLI and API backends) - seems like yak shaving to me though; just don't upgrade the cookbook until you're ready for the versions the newer cookbook works with? Could probably use COMPATIBILITY.md a little more here.

In reference to using the API directly:

  • Usability? Constructing JSON objects is harder IMO than CLI arguments, especially if we'd force the users to do that in their cookbooks
  • Comparison? I'm not seeing how you'd avoid inspecting each value one-by-one regardless of implementation, what if Docker adds information to their JSON or changes the keys between versions? Same thing as #142 point above.
  • Advanced features? Are there API features that are not available via CLI?

Please let me know what you all are thinking.

from docker.

bflad avatar bflad commented on August 15, 2024

For an example of abstracting the implementation with the extra attributes, take the use case I'm fixing right now with pull/push. Since we have a tag attribute available, I can move it behind the scenes from being a CLI arg (--tag=FOO) to being part of the image name (IMAGE:FOO) to match the syntax Docker now wants.

How would we draw a line for what the correct attributes to leave while trimming them? Without having tag available, this seems like it'd be an undue burden for cookbook users here to now change their syntax from:

docker_image 'ubuntu' do
  tag '12.02'
end

To:

docker_image 'ubuntu:12.02'

For no benefit. Same would be true if the Docker API moved it to a different spot.

from docker.

someara avatar someara commented on August 15, 2024

Done!

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.