Comments (7)
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.
How are we feeling about this approach @jcrobak / @ryandub?
from docker.
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.
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.
@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) oradditional_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.
- One thing we can do for "missing" attributes is add a generic "catch all" attribute such as
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.
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.
Done!
from docker.
Related Issues (20)
- (debian-9, installation-script-main) is no longer a valid test HOT 1
- Changelog weirdness
- Containers with embedded health checks restart on every Chef run
- Logging drivers are out of sync
- Can't stop updates to /lib/systemd/system/docker.service
- README.md is missing resources / broken links
- Setting a version causes a service restart on every run HOT 4
- docker_installation_tarball group is always reset HOT 1
- Wrong source list generation for Debian 11 HOT 8
- Use docker_image resource with build_if_missing action with buildkit
- Invalid filter 'dangling=[docker_image_prune[cleanup]]'
- docker Chef 18 compatibility HOT 7
- docker-ce package name in ubuntu 22.04 is in a different format that affects module 'docker_installation_package' HOT 1
- Can't start a simple container
- Dependency Dashboard
- docker_volume_prune resource
- Unable to use `package_name`-property of the `docker_service`-resource
- PR #1253 is a breaking change. Break on CentOS 7 (Old kernel without cgroup v2)
- ipv6 forwarding prevents the daemon to run when ipv6 is disabled in kernel
- docker_container network_mode "container:*" leads to redeploy on every chef client run
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker.