plugin / service configuration modification: how?

  • Hello everyone,
    I am running OMV 4.1.23-1 on Raspberry Pi (both 3 and 4) to try and experiment a bit with docker etc.


    The question I have is not 100% about docker but more about the structure of the OMV Plugins.


    I am struggling to understand the full architecture of the files for each plugin and what a user is supposed to modify and what will be inevitably overwritten during an update.


    Example:
    I would like to change the command used to start the Docker Daemon from this:


    Bash
    /usr/bin/dockerd -H unix:///var/run/docker.sock -g /srv/dev-disk-by-id-mmc-00000_0xf5e95df9-part3/docker

    to this (adding the -H option to expose the docker daemon API in my network:


    Bash
    /usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp:///0.0.0.0:2375 -g /srv/dev-disk-by-id-mmc-00000_0xf5e95df9-part3/docker


    By looking at the plugin repository (https://github.com/OpenMediaVa…openmediavault-docker-gui) I have noticed that the commandline options for the services are set in the "etc/systemd/system/docker.service.d/openmediavault.conf" file.


    I have tried to manually modify the file in my instllation as follow, hoping that it would result into the desiderd command:


    Bash
    [Service]
    EnvironmentFile=-/etc/default/docker
    ExecStart=
    ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375 $DOCKER_OPTS \
        $OMVDOCKER_IMAGE_PATH


    Unfortunately, upon service restart the commandline options are still the old ones.


    Can someone tell me what I am doing wrong? I have the feeling I am following a convoluted path to achieve something that might be obtained in a simpler way.


    Thanks!

  • Thank you for the fast reply!


    I might be missing something anyway, here's the sequence of operation I'm doing.


    1) stopped docker service
    2) modified the /etc/docker/daemon.json file as follows:

    Code
    {
            "hosts": ["tcp://0.0.0.0:2375"]
    }



    3) run "service docker start

    Code
    Warning: The unit file, source configuration file or drop-ins of docker.service changed on disk. Run 'systemctl daemon-reload' to reload units.
    Job for docker.service failed because the control process exited with error code.
    See "systemctl status docker.service" and "journalctl -xe" for details.


    4) run "journalctl -xe"


    Code
    -- Unit docker.service has begun starting up.
    Aug 20 12:32:32 mars dockerd[4187]: 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:///var/run/docker.sock], from file: [tcp://0.0.0.0:2375])
    Aug 20 12:32:32 mars systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
    Aug 20 12:32:32 mars systemd[1]: docker.service: Failed with result 'exit-code'.
    Aug 20 12:32:32 mars systemd[1]: Failed to start Docker Application Container Engine.

    Apparently docker does not like to have some hosts specified from commandline and some from daemon.json.



    What am I missing?

  • This is my current file: "/etc/systemd/system/docker.service.d/openmediavault.conf



    Code
    [Service]
    EnvironmentFile=-/etc/default/docker
    ExecStart=
    ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock $DOCKER_OPTS \
        $OMVDOCKER_IMAGE_PATH

    It seems pretty standard now, is there a way I can start fresh and re-generate that openmediavault.conf?


    Thanks,

  • Ok I might have figured something new.
    If I manually add "hosts": ["tcp://0.0.0.0:2375"] to the /etc/docker/daemon.json file and then run omv-mkconf, the script you mentioned adds also the -H unix:/// to the daemon.json file:


    Code
    nick2k3@ceres:/$ cat /etc/docker/daemon.json
    {
      "data-root": "/srv/dev-disk-by-label-mmc/docker",
      "hosts": [
        "tcp://0.0.0.0:2375",
        "unix:///var/run/docker.sock"
      ]
    }


    the problem is that the file /etc/systemd/system/docker.service.d/openmediavault.conf is still including the [b]-H [/b][b]unix:///[/b] option.


    Code
    [Service]
    EnvironmentFile=-/etc/default/docker
    ExecStart=
    ExecStart=/usr/bin/dockerd -H unix:///var/run/docker.sock $DOCKER_OPTS \
        $OMVDOCKER_IMAGE_PATH


    If I manually edit this last file to (removing the -H unix:// option):


    Code
    [Service]
    EnvironmentFile=-/etc/default/docker
    ExecStart=
    ExecStart=/usr/bin/dockerd $DOCKER_OPTS \
        $OMVDOCKER_IMAGE_PATH

    and run systemctl daemon-reload', then I can star everything correctly:




    my guess is then that the script in /usr/share/openmediavault/mkconf/docker should also remove the -H unix:/// from the command line options used to start the service.



    What do you think, would this be the right path?


    Thanks!

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!