Code Monkey home page Code Monkey logo

Comments (6)

nickjj avatar nickjj commented on June 12, 2024

Hi,

Yeah in this case, I used the default Docker system unit file, which does have -H set.

It sounds like we should introduce another systemd override file for daemon options, and name the variable something so it's not confused with the other one.

That, or get rid of the docker__daemon_environment variable, change it to something like docker__systemd_override: "" which allows you to override anything you want (add environment variables, set daemon options at the unit file level, etc.). Then the environment.conf.j2 template gets renamed to override.conf.j2.

I'm leaning towards the 2nd option because suddenly now you can tweak everything, thoughts?

If that happens maybe docker__daemon_options gets renamed to docker__etc_docker_daemon_json so it's crystal clear on where those settings are getting saved to.

from ansible-docker.

 avatar commented on June 12, 2024

Hey, thanks for the quick reply.

What would the docker__systemd_override would look like? Environment variables and dockerd arguments end up in different places, don't they? (I'm not very confortable with systemd)
Or do you think of two sub-keys in that variable?

docker__daemon_json might be enough to convey the information that its going to be actual JSON text meant to be inserted into daemon.json. I must confess that I had trouble realizing that (of course I didn't quite read the README properly). I was trying for a moment to figure out what sort of strange yaml syntax was expected there...

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

The override variable would be empty by default, but it could look like this:

For adding environment variables:

[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"

For adding daemon options:

[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd://

The empty ExecStart= is needed to null out the old one in the original file.


But with that said, maybe that's too much of a burden for people since they would need to know the inner workings of how systemd works.

A third option could be:

docker__daemon_json configures the /etc/docker/daemon.json file as usual.
docker__daemon_options accepts a list of command line flags (exactly how it used to work)
docker__daemon_environment continues to work as it does now
docker__systemd_override for doing advanced configuration

docker__daemon_options defaults to -H fd:// and writes out /etc/systemd/system/docker.service.d/options.conf with the necessary systemd boilerplate.

When docker__systemd_override is not empty, it writes out /etc/systemd/system/docker.service.d/override.conf with what you put exactly.

Now as an end user you only need to adjust lists for the common overrides, and if you plan to change docker__systemd_override it is expected you know how systemd works.

Sound good?

from ansible-docker.

 avatar commented on June 12, 2024

This sounds great!

I was going to suggest docker__daemon_flags instead of docker__daemon_options to make even more clear what it is. But it may be better to keep the same name to avoid a potential pain point for people migrating.

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

I like docker__daemon_flags because it hints on what type of configuration is expected and the _json variable also does the same thing. Might as well go in all and make it the best it can be since there's going to be migration things to deal with no matter what.

I'll release a new version tomorrow with these changes in place, along with a few other things I've been working on.

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

Ended up doing some late night coding. This is now included in v1.4.0 and it's up on the Galaxy.

from ansible-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.