Overriding existing servervice config

I trying to reduce the stop time of a docker container, I end-up with:

  virtualisation.oci-containers.containers = {
    echo = {
      image = "...";
    };
  };

  systemd.services.docker-echo.serviceConfig.TimeoutStopSec = lib.mkOverride 2;

But i end up with:

building the system configuration...
error: The option `systemd.services.docker-echo.serviceConfig.TimeoutStopSec' has conflicting definition values:
       - In `/nix/store/hsff9pi1qinxljahr833z0xivr1apx27-source/nixos/modules/virtualisation/oci-containers.nix': 120
       - In `/nix/store/hsff9pi1qinxljahr833z0xivr1apx27-source/flake.nix': <function>
(use '--show-trace' to show detailed location information)

How should I do it properly?

mkOverride takes a priority value and the new value for the option. You are just providing the priority, not the value, therefore the returned function and the formerly set value compete with same priority.

Usually you should prefer mkDefault and mkForce, which directly take the value.