Code Monkey home page Code Monkey logo

Comments (11)

nickjj avatar nickjj commented on June 12, 2024 1

It's been a couple of months and I haven't heard anything back, so I'm guessing this is fixed? Going to close this for now.

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

Hi,

What did you set exactly in your playbook / inventory to customize docker__daemon_json?

It should look like this:

docker__daemon_json: |
  "experimental": true,
  "hosts": ["fd://", "tcp://0.0.0.0:2375"]

Also, you'll always see /etc/docker/daemon.json being set by this role since it configures the log driver (unless you disabled that). Your custom settings should be included under that.

from ansible-docker.

rong0312 avatar rong0312 commented on June 12, 2024

I have changed the 'docker__daemon_json' variable as you wrote under 'defaults' folder (main.yml).
I did not put anything special inside my playbook- only activated the role.
Do I have to specify some thing?

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

Did you run my role or your forked copy?

Typically you wouldn't modify variables directly in a role. You would modify them by overriding variables in your inventory.

from ansible-docker.

rong0312 avatar rong0312 commented on June 12, 2024

I totally forgot that I have changed a few things in task's yml to make it work with centos as well.
I changed back to your tasks but received that when running the playbook.

Sep 03 06:13:21 ip-10-2-11-24 systemd[1]: docker.service: Start request repeated too quickly.
Sep 03 06:13:21 ip-10-2-11-24 systemd[1]: Failed to start Docker Application Container Engine.
Sep 03 06:13:21 ip-10-2-11-24 systemd[1]: docker.service: Unit entered failed state.
Sep 03 06:13:21 ip-10-2-11-24 systemd[1]: docker.service: Failed with result 'start-limit-hit'.

I'm pretty sure it's related to the altered daemon.json
Did it happen to you?

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

What does your /etc/docker/daemon.json look like on your server? Paste it here.

Also what does journalctl say about that failing Docker service?

I have not encountered that while modifying that file.

If you take a look at the tests for this role, I made a bunch of changes to various config files. You can see that playbook here: https://github.com/nickjj/ansible-docker/blob/master/tests/test.yml

If I were to guess, it's probably a conflict with the hosts in the daemon.json config file conflicting with the one in the unit file. For a long time Docker didn't allow you to set hosts in daemon.json, but now I think they might let you, but you can't have it defined in 2 different configs.

Try keeping your custom json but set docker__daemon_flags to [].

from ansible-docker.

rong0312 avatar rong0312 commented on June 12, 2024

my daemon.json:

{
  "log-driver": "journald"
,  "experimental": true,
  "hosts": ["fd://", "tcp://0.0.0.0:2375"]

}

journalctl:

-- Unit docker.service has begun starting up.
Sep 03 11:33:37 ip-10-2-11-24 dockerd[6614]: unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (from flag: [unix://], fr
Sep 03 11:33:37 ip-10-2-11-24 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Sep 03 11:33:37 ip-10-2-11-24 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd

&

-- The start-up result is done.
Sep 03 11:33:40 ip-10-2-11-24 systemd[1]: docker.service: Start request repeated too quickly.
Sep 03 11:33:40 ip-10-2-11-24 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
Sep 03 11:33:40 ip-10-2-11-24 systemd[1]: docker.socket: Unit entered failed state.
Sep 03 11:33:40 ip-10-2-11-24 systemd[1]: docker.service: Unit entered failed state.
Sep 03 11:33:40 ip-10-2-11-24 systemd[1]: docker.service: Failed with result 'start-limit-hit'.

i guess this is the problem, even due the fact this is my new playbook:

---
- hosts: "{{ host_var | default('test-ubuntu') }}"
  remote_user: "{{ user_var | default('ubuntu') }}"
  become: true
  gather_facts: yes

  vars:
    docker__daemon_json: |
      "experimental": true,
      "hosts": ["fd://", "tcp://0.0.0.0:2375"]

    docker__daemon_flags: []

  roles:
    # - ansible-users
    # - machine-install
    - ansible-docker

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

The error says it all:

Sep 03 11:33:37 ip-10-2-11-24 dockerd[6614]: unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: hosts: (from flag: [unix://]

That means you haven't ran what you have defined in your playbook, or those vars aren't taking effect in your playbook.

from ansible-docker.

rong0312 avatar rong0312 commented on June 12, 2024

Did i run them incorrectly?

from ansible-docker.

nickjj avatar nickjj commented on June 12, 2024

No, it looks good.

But the error you pasted doesn't line up to what you have in the playbook you pasted.

The error says you have hosts defined in both your json file and the daemon flag and it even goes as far as saying it's using unix:// as the value, which is the default docker__daemon_flags value from this role, which makes me think your variables aren't being used due to reasons unknown.

Maybe you're not running that playbook, maybe you forgot to save the playbook, maybe you're checking the results on the wrong server. It's hard to say.

from ansible-docker.

rong0312 avatar rong0312 commented on June 12, 2024

Ok nick ill take your opinion. I will keep trying to figure out what's going on.
Thank you for your time!

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.