Run a systemd unit in a specified network namespace

Looks like it's now possible to do this in systemd 242 via the NetworkNamespacePath option: announcement.

Check out the docs for use it here.


systemd is not fully compatible with network namespace as the issues https://github.com/systemd/systemd/issues/2741, may add some other key words like ExecStart to add network namespace switch into namespace before running service.