Use user data path for plugin discovery in rootless mode
Signed-off-by: Jan Garcia <github-public@n-garcia.com>

fixes #43111

**- What I did**

We now dynamically determine the plugins path when running in rootless mode.

**- How I did it**

Introduce a new function, `plugins.SpecsPaths` which returns `$XDG_DATA_HOME/.local/share/docker/plugins`
on Unix in rootless mode and `specsPaths` otherwise.

**- How to verify it**

You can test this by running `dockerd` in rootless mode while `/etc/docker` is not accessible by the user.
Without this patch, creating volumes will fail. With this patch creating volumes works.

**- Description for the changelog**

Use user data path for plugin discovery in rootless mode

pkg/plugins/discovery_unix.go
//go:build !windows
// +build !windows

package plugins // import "github.com/docker/docker/pkg/plugins"

var specsPaths = []string{"/etc/docker/plugins", "/usr/lib/docker/plugins"}

//go:build !windows
// +build !windows

package plugins // import "github.com/docker/docker/pkg/plugins"
import (
	"path/filepath"

	"github.com/docker/docker/pkg/homedir"
	"github.com/docker/docker/pkg/rootless"
)

const globalConfigPluginsPath = "/etc/docker/plugins"
const globalLibPluginsPath = "/usr/lib/docker/plugins"

var globalSpecsPaths = []string{globalConfigPluginsPath, globalLibPluginsPath}

func rootlessConfigPluginsPath() string {
	configHome, err := homedir.GetConfigHome()
	if err == nil {
		return filepath.Join(configHome, "docker/plugins")
	}

	return globalConfigPluginsPath
}

func rootlessLibPluginsPath() string {
	libHome, err := homedir.GetLibHome()
	if err == nil {
		return filepath.Join(libHome, "docker/plugins")
	}

	return globalLibPluginsPath
}

// SpecsPaths returns
// { "%programdata%\docker\plugins" } on Windows,
// { "/etc/docker/plugins", "/usr/lib/docker/plugins" } on Unix in non-rootless mode,
// { "$XDG_CONFIG_HOME/docker/plugins", "$HOME/.local/lib/docker/plugins" } on Unix in rootless mode
// with fallback to the corresponding path in non-rootless mode if $XDG_CONFIG_HOME or $HOME is not set.
func SpecsPaths() []string {
	if rootless.RunningWithRootlessKit() {
		return []string{rootlessConfigPluginsPath(), rootlessLibPluginsPath()}
	}

	return globalSpecsPaths
}

I introduced `func SpecsPaths() []string` while keeping `specsPaths` around to avoid a large diff in the Unit-Tests.

> would it do any harm to unconditionally append `homedir.GetDataHome()` to the list of paths to look in? 

Right now the user can use his own plugins without being affected by plugins installed in the host system.
If we add `$XDG_DATA_HOME/.local/share/docker/plugins` to `SpecsPaths` unconditionally, the user no longer has this option