mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 03:53:33 +00:00
chore(push): run unregistry only if containerd image store enabled for docker
This commit is contained in:
+19
-10
@@ -437,17 +437,26 @@ func (m *Machine) Run(ctx context.Context) error {
|
|||||||
|
|
||||||
var unreg *unregistry.Registry
|
var unreg *unregistry.Registry
|
||||||
if m.config.ContainerdSockPath != "" {
|
if m.config.ContainerdSockPath != "" {
|
||||||
// Create an embedded container registry listening on the machine IP address and
|
isContainerdStore, err := m.dockerService.IsContainerdImageStoreEnabled(ctx)
|
||||||
// using the local Docker (containerd) image store as its backend.
|
|
||||||
unreg, err = unregistry.NewRegistry(unregistry.Config{
|
|
||||||
Addr: net.JoinHostPort(m.IP().String(), strconv.Itoa(constants.UnregistryPort)),
|
|
||||||
ContainerdNamespace: "moby",
|
|
||||||
ContainerdSock: m.config.ContainerdSockPath,
|
|
||||||
LogFormatter: "text",
|
|
||||||
LogLevel: "info",
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("create embedded registry: %w", err)
|
return fmt.Errorf("check if Docker uses containerd image store: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if isContainerdStore {
|
||||||
|
// Create an embedded container registry listening on the machine IP address and
|
||||||
|
// using the local Docker (containerd) image store as its backend.
|
||||||
|
unreg, err = unregistry.NewRegistry(unregistry.Config{
|
||||||
|
Addr: net.JoinHostPort(m.IP().String(), strconv.Itoa(constants.UnregistryPort)),
|
||||||
|
ContainerdNamespace: "moby",
|
||||||
|
ContainerdSock: m.config.ContainerdSockPath,
|
||||||
|
LogFormatter: "text",
|
||||||
|
LogLevel: "info",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("create embedded registry: %w", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
slog.Warn("Skipping embedded unregistry setup as Docker is not using the containerd image store.")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
slog.Warn("Skipping embedded unregistry setup as the containerd socket path is not configured.")
|
slog.Warn("Skipping embedded unregistry setup as the containerd socket path is not configured.")
|
||||||
|
|||||||
Reference in New Issue
Block a user