service

package
v1.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package service implements `dockercmd --install-service` and friends: it installs Docker Commander as a background service for the current OS so the monitor, alert engine and metric history keep running without a browser.

Linux installs the hardened systemd unit (the same one in deploy/, embedded here and kept identical by a test); macOS installs a per-user launchd LaunchAgent; Windows registers a real Service Control Manager (SCM) service (a plain console exe isn't a native service and the SCM gives up on it with error 1053, which is why deploy/install-windows.ps1's Scheduled Task remains available as an alternative that needs no elevation-per-boot subtleties).

The OS-specific Install/Uninstall/Status live in service_{linux,darwin,windows}.go; this file holds the embedded templates and small shared helpers. service_windows.go additionally exposes IsWindowsService/RunWindowsService, the SCM entry point used by cmd/dockercmd when the process is started by the service manager rather than a console; service_notwindows.go stubs those two out everywhere else.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(w io.Writer) error

Install sets Docker Commander up as a systemd service: it copies the binary to a stable path, creates a dedicated unprivileged user in the docker group, writes the hardened unit, and enables + starts it. Requires root.

func IsWindowsService added in v1.6.1

func IsWindowsService() bool

IsWindowsService always reports false outside Windows: there is no Service Control Manager to have started this process.

func RunWindowsService added in v1.6.1

func RunWindowsService(func(context.Context) error) error

RunWindowsService only does something on Windows (service_windows.go). This stub exists so cmd/dockercmd can call it unconditionally across platforms; it is never actually invoked here because IsWindowsService() is always false on this OS.

func Status

func Status(w io.Writer) error

Status prints `systemctl status` for the service.

func Uninstall

func Uninstall(w io.Writer) error

Uninstall stops and removes the systemd service. The data dir and the service user are left in place so reinstalling keeps the database and keys.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL