Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
chore(deps): bump github.com/docker/compose to v5.5.0 (#3643)
Kyle Mendelle013a757deb7
diff --git a/backend/cli/upgrade/upgrade.go b/backend/cli/upgrade/upgrade.goindex b77b23100..186a99cf1 100644--- a/backend/cli/upgrade/upgrade.go+++ b/backend/cli/upgrade/upgrade.go@@ -11,7 +11,9 @@ import ("emperror.dev/errors"+ "github.com/containerd/platforms""github.com/moby/moby/api/types/container"+ "github.com/moby/moby/api/types/image""github.com/moby/moby/api/types/network""github.com/moby/moby/client""github.com/spf13/cobra"@@ -209,7 +211,7 @@ func normalizeRecreatedArcaneLabelsInternal(containerLabels map[string]string) mreturn normalized}-func refreshRecreatedImageLabelsInternal(containerLabels, previousImageLabels, imageLabels map[string]string, imageID string) map[string]string {+func refreshRecreatedImageLabelsInternal(containerLabels, previousImageLabels, imageLabels map[string]string, imageDigest string) map[string]string {refreshed := maps.Clone(containerLabels)for key, value := range containerLabels {if !strings.HasPrefix(strings.ToLower(key), "org.opencontainers.image.") {@@ -243,10 +245,10 @@ func refreshRecreatedImageLabelsInternal(containerLabels, previousImageLabels, irefreshed[key] = value}- if refreshed != nil && imageID != "" {+ if refreshed != nil && imageDigest != "" {for key := range refreshed {if strings.EqualFold(key, "com.docker.compose.image") {- refreshed[key] = imageID+ refreshed[key] = imageDigest}}}@@ -254,8 +256,39 @@ func refreshRecreatedImageLabelsInternal(containerLabels, previousImageLabels, ireturn refreshed}+// composeImageDigestInternal selects the digest compose v5.5.0 records in the+// com.docker.compose.image label: the host platform's image-manifest digest,+// which stays stable across attested rebuilds, falling back to the top-level+// image ID when the engine reports no manifest data (mirrors compose's+// localContentDigest). Writing any other value would make compose flag the+// container as diverged and recreate it on the next up.+func composeImageDigestInternal(inspect client.ImageInspectResult) string {+ matcher := platforms.Default()+ var available []image.ManifestSummary+ for _, m := range inspect.Manifests {+ if m.Kind == image.ManifestKindImage && m.Available {+ available = append(available, m)+ }+ }+ for _, m := range available {+ if m.ImageData != nil && matcher.Match(m.ImageData.Platform) {+ return m.ID+ }+ }+ if len(available) == 1 {+ return available[0].ID+ }+ return inspect.ID+}+func refreshRecreatedContainerLabelsInternal(ctx context.Context, dockerClient *client.Client, containerLabels map[string]string, previousImage, targetImage string) map[string]string {- imageInspect, imageInspectErr := dockerClient.ImageInspect(ctx, targetImage)+ // Manifest data is needed to record the platform manifest digest compose+ // v5.5.0 expects in com.docker.compose.image; older daemons may reject the+ // option, so retry without it and fall back to the top-level image ID.+ imageInspect, imageInspectErr := dockerClient.ImageInspect(ctx, targetImage, client.ImageInspectWithManifests(true))+ if imageInspectErr != nil {+ imageInspect, imageInspectErr = dockerClient.ImageInspect(ctx, targetImage)+ }if imageInspectErr != nil {slog.Warn("Could not inspect target image labels; preserving container OCI overrides","image", targetImage,@@ -280,7 +313,7 @@ func refreshRecreatedContainerLabelsInternal(ctx context.Context, dockerClient *}}}- return refreshRecreatedImageLabelsInternal(containerLabels, previousImageLabels, imageLabels, imageInspect.ID)+ return refreshRecreatedImageLabelsInternal(containerLabels, previousImageLabels, imageLabels, composeImageDigestInternal(imageInspect))}func hasOCIImageLabelInternal(containerLabels map[string]string) bool {diff --git a/backend/go.mod b/backend/go.modindex 9a0e37fd7..e33beb723 100644--- a/backend/go.mod+++ b/backend/go.mod@@ -23,7 +23,7 @@ require (github.com/danielgtaylor/huma/v2 v2.39.1github.com/distribution/reference v0.6.0github.com/docker/cli v29.7.2+incompatible- github.com/docker/compose/v5 v5.4.0+ github.com/docker/compose/v5 v5.5.0github.com/docker/go-units v0.5.0github.com/fsnotify/fsnotify v1.10.1github.com/getarcaneapp/arcane/cli/v2 v2.6.0@@ -125,7 +125,7 @@ require (github.com/depot/depot-go v0.5.2 // indirectgithub.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352 // indirectgithub.com/digitorus/timestamp v0.0.0-20231217203849-220c5c2851b7 // indirect- github.com/docker/buildx v0.36.0 // indirect+ github.com/docker/buildx v0.36.1 // indirectgithub.com/docker/docker v28.5.2+incompatible // indirectgithub.com/docker/docker-credential-helpers v0.9.8 // indirectgithub.com/docker/go-connections v0.7.0 // indirect@@ -214,7 +214,7 @@ require (github.com/mfridman/interpolate v0.0.2 // indirectgithub.com/mitchellh/hashstructure/v2 v2.0.2 // indirectgithub.com/moby/docker-image-spec v1.3.1 // indirect- github.com/moby/go-archive v0.3.2 // indirect+ github.com/moby/go-archive v0.3.3 // indirectgithub.com/moby/locker v1.0.1 // indirectgithub.com/moby/patternmatcher v0.6.1 // indirectgithub.com/moby/policy-helpers v0.0.0-20260722051018-856be88baec4 // indirectdiff --git a/backend/go.sum b/backend/go.sumindex ffcbbab1e..291316170 100644--- a/backend/go.sum+++ b/backend/go.sum@@ -203,12 +203,12 @@ github.com/distribution/reference v0.6.0 h1:0IXCQ5g4/QMHHkarYzh5l+u8T3t73zM5Qvfrgithub.com/distribution/reference v0.6.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E=github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=-github.com/docker/buildx v0.36.0 h1:5UYbvkIXhkjiRZG15ZoWuA1BIuFatexA9yeL+b72MpM=-github.com/docker/buildx v0.36.0/go.mod h1:APOldMT9ejTIiYJ44OxhFX1zt+MM1cR9zz4DQLq8qLw=+github.com/docker/buildx v0.36.1 h1:U7JTUSSeooFXbG+0HcI+CMjEIkvuZgJegXRZ1q7K63Q=+github.com/docker/buildx v0.36.1/go.mod h1:pkpx66TqJD4HOS65fORu9MYBEDbeiRxnGdN3VpH8SPM=github.com/docker/cli v29.7.2+incompatible h1:dlkwallR8XqfeVnA2ELEhdwvb4lsSwuB4IgsG8Q9cLY=github.com/docker/cli v29.7.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=-github.com/docker/compose/v5 v5.4.0 h1:i0xFmVvWv9QILfRE2PD07GmQqJYjpYAGutafIrJLURE=-github.com/docker/compose/v5 v5.4.0/go.mod h1:bNeEncwZhG0F4MN+0zgln4EA2ILqGZC7knRI8QYJz9U=+github.com/docker/compose/v5 v5.5.0 h1:B5Eh5CtlbscCMlbyMydbEj3rpIuP9GthdD7PC0IsvgQ=+github.com/docker/compose/v5 v5.5.0/go.mod h1:5yn5qs7G7V7OZc1Kkd6wLz72Le0C45xLNJQ7dgASvMk=github.com/docker/distribution v2.8.3+incompatible h1:AtKxIZ36LoNK51+Z6RpzLpddBirtxJnzDrHLEKxTAYk=github.com/docker/distribution v2.8.3+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=github.com/docker/docker v28.5.2+incompatible h1:DBX0Y0zAjZbSrm1uzOkdr1onVghKaftjlSWt4AFexzM=@@ -508,8 +508,8 @@ github.com/moby/buildkit v0.32.2 h1:Sfy7+u6dUv/2yuBc9KCoK70Re8atuV8aPZ5UOC068Vc=github.com/moby/buildkit v0.32.2/go.mod h1:0GB/EJ1d+4VIVqIAgy3asaoGkVXy7IrDfVy7mPhOvg8=github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=-github.com/moby/go-archive v0.3.2 h1:x893kC3zRygv2C+k4Y9kMxYRPLCj4XEJB0srbAP06Hw=-github.com/moby/go-archive v0.3.2/go.mod h1:Npdv43fFqlhZW7Xo8fbm3ZMYFvAGNviUPqX21VERbcE=+github.com/moby/go-archive v0.3.3 h1:OxxR9paxsluYi+zDUEXTTaIxtkK3viymW+Ka7vRhhME=+github.com/moby/go-archive v0.3.3/go.mod h1:Npdv43fFqlhZW7Xo8fbm3ZMYFvAGNviUPqX21VERbcE=github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=github.com/moby/moby/api v1.55.0 h1:2/sexvQyqIWS8pRSCFddBfpW2qE7vR7FCL+vN8pxwMc=@@ -524,6 +524,8 @@ github.com/moby/sys/atomicwriter v0.1.0 h1:kw5D/EqkBwsBFi0ss9v1VG3wIkVhzGvLklJ+wgithub.com/moby/sys/atomicwriter v0.1.0/go.mod h1:Ul8oqv2ZMNHOceF643P6FKPXeCmYtlQMvpizfsSoaWs=github.com/moby/sys/capability v0.4.0 h1:4D4mI6KlNtWMCM1Z/K0i7RV1FkX+DBDHKVJpCndZoHk=github.com/moby/sys/capability v0.4.0/go.mod h1:4g9IK291rVkms3LKCDOoYlnV8xKwoDTpIrNEE35Wq0I=+github.com/moby/sys/mount v0.3.5 h1:eS3fsZTjHaBihwjp4/+5Z3jxqLXYsbwxqpVSfFv3M00=+github.com/moby/sys/mount v0.3.5/go.mod h1:WUQDO+/uCiCIkIztx8SrwIDVn2dtMFRBebRhpDFT71M=github.com/moby/sys/mountinfo v0.7.2 h1:1shs6aH5s4o5H2zQLn796ADW1wMrIwHsyJ2v9KouLrg=github.com/moby/sys/mountinfo v0.7.2/go.mod h1:1YOa8w8Ih7uW0wALDUgT1dTTSBrZ+HiBLGws92L2RU4=github.com/moby/sys/sequential v0.7.0 h1:ASQNGNROJSuOO6LL6bPHbKvuZu6NU8P4ldPWk31zj/8=diff --git a/backend/internal/image/image.go b/backend/internal/image/image.goindex 3aad5902e..e84466210 100644--- a/backend/internal/image/image.go+++ b/backend/internal/image/image.go@@ -240,6 +240,22 @@ func (s *ImageService) PullImage(ctx context.Context, imageName string, progressreturn nil}+// ImageLastTagTime returns when the local image was last tagged, zero when the+// engine doesn't report it. Pull-policy refresh windows compare against this+// timestamp, the same clock compose v5.5.0 uses.+func (s *ImageService) ImageLastTagTime(ctx context.Context, imageName string) (time.Time, error) {+ dockerClient, err := s.dockerService.GetClient(ctx)+ if err != nil {+ return time.Time{}, errors.WrapIf(err, "failed to connect to Docker")+ }++ inspect, err := dockerClient.ImageInspect(ctx, imageName)+ if err != nil {+ return time.Time{}, errors.WrapIff(err, "failed to inspect image %s", imageName)+ }+ return inspect.Metadata.LastTagTime, nil+}+func (s *ImageService) ReconcilePulledImageUpdate(ctx context.Context, imageName string) error {if s.imageUpdateService == nil {return nildiff --git a/backend/internal/imageupdate/image_update.go b/backend/internal/imageupdate/image_update.goindex 7fb333eaf..7be2696d7 100644--- a/backend/internal/imageupdate/image_update.go+++ b/backend/internal/imageupdate/image_update.go@@ -454,6 +454,16 @@ func (s *ImageUpdateService) checkDigestUpdateWithSnapshotInternal(ctx context.C}}+ // This comparison is deliberately index-level: local RepoDigests record the+ // multi-platform index digest a tag resolved to at pull time, and the+ // registry digest above is the same index-level value — "update available"+ // answers "would a pull fetch something new for this tag". Compose (v5.5.0+)+ // instead recreates containers based on the platform-specific manifest+ // digest in its com.docker.compose.image label, so a multi-arch tag whose+ // *other* platform changed can show an update here while a redeploy+ // correctly recreates nothing; the pull still clears the badge. Do not+ // "align" this to platform-level digests — that would require per-platform+ // registry manifest fetches for no user-visible gain.localDigest := snapshot.PrimaryDigesthasUpdate := truefor _, localDig := range snapshot.AllDigests {diff --git a/backend/internal/project/project_lifecycle.go b/backend/internal/project/project_lifecycle.goindex bef5a4715..ed9a869ca 100644--- a/backend/internal/project/project_lifecycle.go+++ b/backend/internal/project/project_lifecycle.go@@ -682,15 +682,27 @@ func (s *ProjectService) EnsureProjectImagesPresent(ctx context.Context, projectreturn s.ensureImagesPresent(ctx, pullPlan, progressWriter, credentials, user)}-func (s *ProjectService) ensureImagesPresent(ctx context.Context, pullPlan map[string]projects.ImagePullMode, progressWriter io.Writer, credentials []containerregistry.Credential, user common.User) error {- for img, mode := range pullPlan {+// imageRefreshDueInternal reports whether a pull_policy refresh window has+// elapsed for a locally present image, using the engine's last-tag time as+// compose v5.5.0 does; an unknown time counts as due.+func (s *ProjectService) imageRefreshDueInternal(ctx context.Context, imageRef string, window time.Duration) bool {+ lastTagged, err := s.imageService.ImageLastTagTime(ctx, imageRef)+ if err != nil {+ slog.WarnContext(ctx, "failed to resolve image last-tag time; treating refresh as due", "image", imageRef, "error", err)+ return true+ }+ return lastTagged.IsZero() || time.Now().After(lastTagged.Add(window))+}++func (s *ProjectService) ensureImagesPresent(ctx context.Context, pullPlan map[string]projects.ImagePullStep, progressWriter io.Writer, credentials []containerregistry.Credential, user common.User) error {+ for img, step := range pullPlan {exists, ierr := s.imageService.ImageExistsLocally(ctx, img)- if ierr != nil && mode != projects.ImagePullModeAlways {+ if ierr != nil && step.Mode != projects.ImagePullModeAlways {slog.WarnContext(ctx, "failed to check local image existence", "image", img, "error", ierr)// Non-fatal: attempt to pull to be safe}- if mode == projects.ImagePullModeNever {+ if step.Mode == projects.ImagePullModeNever {if ierr != nil {slog.WarnContext(ctx, "pull_policy is 'never' but image presence check failed; continuing without pull", "image", img, "error", ierr)continue@@ -702,11 +714,16 @@ func (s *ProjectService) ensureImagesPresent(ctx context.Context, pullPlan map[scontinue}- if mode == projects.ImagePullModeIfMissing && exists {+ if step.Mode == projects.ImagePullModeIfMissing && exists {slog.DebugContext(ctx, "image already present locally; skipping pull", "image", img)continue}+ if step.Mode == projects.ImagePullModeRefresh && exists && !s.imageRefreshDueInternal(ctx, img, step.RefreshAfter) {+ slog.DebugContext(ctx, "pull_policy refresh window has not elapsed; skipping pull", "image", img, "window", step.RefreshAfter)+ continue+ }+if err := s.pullAndReconcileImageInternal(ctx, img, progressWriter, user, credentials); err != nil {return err}@@ -753,6 +770,8 @@ func (s *ProjectService) prepareProjectImagesForDeploy(dependentDecision = projects.DeployImageDecision{RequireLocalOnly: true}case decision.PullAlways:dependentDecision = projects.DeployImageDecision{PullAlways: true}+ case decision.PullIfStale:+ dependentDecision = projects.DeployImageDecision{PullIfStale: true, StaleAfter: decision.StaleAfter}}dependentImages := api.GetDependentImages(svc, project.Name)for _, vol := range svc.Volumes {@@ -798,7 +817,17 @@ func (s *ProjectService) ensureDeployServiceImageReady(return nil}- if !projects.ShouldPullDeployImage(decision, exists) {+ var lastTagged time.Time+ if decision.PullIfStale && exists {+ var tagErr error+ lastTagged, tagErr = s.imageService.ImageLastTagTime(ctx, imageName)+ if tagErr != nil {+ // Unknown last-tag time counts as stale, matching the missing-record+ // behavior of compose's refresh handling.+ slog.WarnContext(ctx, "failed to resolve image last-tag time; treating refresh as due", "image", imageName, "error", tagErr)+ }+ }+ if !projects.ShouldPullDeployImage(decision, exists, lastTagged) {return nil}diff --git a/backend/internal/project/service_test.go b/backend/internal/project/service_test.goindex 04bc80d57..6172c940e 100644--- a/backend/internal/project/service_test.go+++ b/backend/internal/project/service_test.go@@ -756,8 +756,8 @@ func TestProjectService_EnsureImagesPresent_UpdatesCurrentImageRecordAfterPull(tCheckTime: time.Now().UTC().Add(-time.Hour),}).Error)- require.NoError(t, svc.ensureImagesPresent(ctx, map[string]projects.ImagePullMode{- imageRef: projects.ImagePullModeAlways,+ require.NoError(t, svc.ensureImagesPresent(ctx, map[string]projects.ImagePullStep{+ imageRef: {Mode: projects.ImagePullModeAlways},}, io.Discard, nil, common.SystemUser))// sha256:old-api may still be in use by another container — pulling for one containerdiff --git a/backend/pkg/projects/pull_policy.go b/backend/pkg/projects/pull_policy.goindex de9476425..d32edf591 100644--- a/backend/pkg/projects/pull_policy.go+++ b/backend/pkg/projects/pull_policy.go@@ -3,6 +3,7 @@ package projectsimport ("log/slog""strings"+ "time"composetypes "github.com/compose-spec/compose-go/v2/types"composeapi "github.com/docker/compose/v5/pkg/api"@@ -16,85 +17,107 @@ const (ImagePullModeNever ImagePullMode = iota// ImagePullModeIfMissing pulls only when the image is missing locally.ImagePullModeIfMissing+ // ImagePullModeRefresh pulls when the image is missing locally or was last+ // tagged longer ago than the policy's refresh window.+ ImagePullModeRefresh// ImagePullModeAlways pulls even when the image is present locally.ImagePullModeAlways)+// ImagePullStep is one entry of an image pull plan: the mode plus, for+// ImagePullModeRefresh, the window after which a new pull is due.+type ImagePullStep struct {+ Mode ImagePullMode+ RefreshAfter time.Duration+}+// DeployImageDecision describes how deploy should handle a service image.type DeployImageDecision struct {- Build bool- PullAlways bool- PullIfMissing bool+ Build bool+ PullAlways bool+ PullIfMissing bool+ // PullIfStale pulls when the image is missing or its last-tag time is+ // older than StaleAfter (pull_policy daily/weekly/every_N).+ PullIfStale bool+ StaleAfter time.DurationFallbackBuildOnPullFail boolRequireLocalOnly bool}-// ResolveServiceImagePullMode resolves compose pull_policy into Arcane's pull mode.-func ResolveServiceImagePullMode(svc composetypes.ServiceConfig) ImagePullMode {+// ResolveServiceImagePullMode resolves compose pull_policy into Arcane's pull step.+func ResolveServiceImagePullMode(svc composetypes.ServiceConfig) ImagePullStep {rawPolicy := strings.ToLower(strings.TrimSpace(svc.PullPolicy))- switch {- case rawPolicy == composetypes.PullPolicyNever:- return ImagePullModeNever- case rawPolicy == composetypes.PullPolicyAlways:- return ImagePullModeAlways- case rawPolicy == composetypes.PullPolicyRefresh,- rawPolicy == "daily",- rawPolicy == "weekly",- strings.HasPrefix(rawPolicy, "every_"):- return ImagePullModeAlways- case rawPolicy == composetypes.PullPolicyMissing,- rawPolicy == composetypes.PullPolicyIfNotPresent,- rawPolicy == composetypes.PullPolicyBuild,- rawPolicy == "":- return ImagePullModeIfMissing+ switch rawPolicy {+ case composetypes.PullPolicyNever:+ return ImagePullStep{Mode: ImagePullModeNever}+ case composetypes.PullPolicyAlways:+ return ImagePullStep{Mode: ImagePullModeAlways}+ case composetypes.PullPolicyMissing,+ composetypes.PullPolicyIfNotPresent,+ composetypes.PullPolicyBuild,+ "":+ return ImagePullStep{Mode: ImagePullModeIfMissing}}- policy, _, err := svc.GetPullPolicy()+ // Refresh windows (daily, weekly, every_<duration>) and anything else:+ // compose-go owns the parsing, matching compose's own `up` semantics —+ // unknown or unparseable policies fall back to pull-if-missing.+ normalized := svc+ normalized.PullPolicy = rawPolicy+ policy, refreshAfter, err := normalized.GetPullPolicy()if err != nil {slog.Warn("failed to parse service pull_policy, defaulting to missing", "service", svc.Name, "pull_policy", svc.PullPolicy, "error", err)- return ImagePullModeIfMissing+ return ImagePullStep{Mode: ImagePullModeIfMissing}}-switch policy {case composetypes.PullPolicyNever:- return ImagePullModeNever- case composetypes.PullPolicyAlways, composetypes.PullPolicyRefresh:- return ImagePullModeAlways- case composetypes.PullPolicyMissing, composetypes.PullPolicyIfNotPresent, composetypes.PullPolicyBuild:- return ImagePullModeIfMissing+ return ImagePullStep{Mode: ImagePullModeNever}+ case composetypes.PullPolicyAlways:+ return ImagePullStep{Mode: ImagePullModeAlways}+ case composetypes.PullPolicyRefresh:+ return ImagePullStep{Mode: ImagePullModeRefresh, RefreshAfter: refreshAfter}default:- return ImagePullModeIfMissing+ return ImagePullStep{Mode: ImagePullModeIfMissing}+ }+}++// morePullEagerInternal reports whether a beats b in a pull plan: a higher+// mode wins, and between two refresh policies the shorter window does.+func morePullEagerInternal(a, b ImagePullStep) bool {+ if a.Mode != b.Mode {+ return a.Mode > b.Mode}+ return a.Mode == ImagePullModeRefresh && a.RefreshAfter < b.RefreshAfter}// BuildImagePullPlan builds a deduplicated image pull plan covering non-build// service images, pre_start hook images, and type:image volume sources.-func BuildImagePullPlan(project *composetypes.Project) map[string]ImagePullMode {- plan := map[string]ImagePullMode{}- record := func(img string, mode ImagePullMode) {+func BuildImagePullPlan(project *composetypes.Project) map[string]ImagePullStep {+ plan := map[string]ImagePullStep{}+ record := func(img string, step ImagePullStep) {img = strings.TrimSpace(img)if img == "" {return}- if existing, exists := plan[img]; !exists || mode > existing {- plan[img] = mode+ if existing, exists := plan[img]; !exists || morePullEagerInternal(step, existing) {+ plan[img] = step}}for _, svc := range project.Services {- mode := ResolveServiceImagePullMode(svc)+ step := ResolveServiceImagePullMode(svc)if svc.Build == nil {- record(svc.Image, mode)+ record(svc.Image, step)}// pre_start hook images inherit the parent service's policy, except that// they can never be built: `build` still means pull-if-missing here.- if mode != ImagePullModeNever {+ if step.Mode != ImagePullModeNever {for _, img := range composeapi.GetDependentImages(svc, project.Name) {- record(img, mode)+ record(img, step)}}for _, vol := range svc.Volumes {if vol.Type == composetypes.VolumeTypeImage {- record(vol.Source, ImagePullModeIfMissing)+ record(vol.Source, ImagePullStep{Mode: ImagePullModeIfMissing})}}}@@ -121,12 +144,23 @@ func NormalizeDeployPullPolicy(policy string) string {}}-// IsAlwaysPullPolicy reports whether policy means always pull.+// IsAlwaysPullPolicy reports whether policy means an unconditional pull.+// Refresh windows (daily/weekly/every_N) are not "always": they pull only+// once their window has elapsed, matching compose v5.5.0.func IsAlwaysPullPolicy(policy string) bool {- if policy == "always" || policy == "daily" || policy == "weekly" {- return true+ return policy == "always"+}++// refreshWindowForPolicyInternal resolves policy as a refresh window+// (daily/weekly/every_N), reporting false for every other policy.+func refreshWindowForPolicyInternal(svc composetypes.ServiceConfig, policy string) (time.Duration, bool) {+ normalized := svc+ normalized.PullPolicy = policy+ parsed, window, err := normalized.GetPullPolicy()+ if err != nil || parsed != composetypes.PullPolicyRefresh {+ return 0, false}- return strings.HasPrefix(policy, "every_")+ return window, true}// DecideDeployImageAction decides whether deploy should build, pull, or require local images.@@ -152,6 +186,9 @@ func DecideDeployImageAction(svc composetypes.ServiceConfig, pullPolicyOverridecase policy == "":return DeployImageDecision{PullIfMissing: true, FallbackBuildOnPullFail: true}default:+ if window, ok := refreshWindowForPolicyInternal(svc, policy); ok {+ return DeployImageDecision{PullIfStale: true, StaleAfter: window}+ }return DeployImageDecision{PullIfMissing: true}}}@@ -162,6 +199,9 @@ func DecideDeployImageAction(svc composetypes.ServiceConfig, pullPolicyOverridecase IsAlwaysPullPolicy(policy):return DeployImageDecision{PullAlways: true}default:+ if window, ok := refreshWindowForPolicyInternal(svc, policy); ok {+ return DeployImageDecision{PullIfStale: true, StaleAfter: window}+ }return DeployImageDecision{PullIfMissing: true}}}diff --git a/backend/pkg/projects/pull_policy_test.go b/backend/pkg/projects/pull_policy_test.goindex a137c2123..60a2d2865 100644--- a/backend/pkg/projects/pull_policy_test.go+++ b/backend/pkg/projects/pull_policy_test.go@@ -2,6 +2,7 @@ package projectsimport ("testing"+ "time"composetypes "github.com/compose-spec/compose-go/v2/types""github.com/stretchr/testify/assert"@@ -11,42 +12,64 @@ func TestResolveServiceImagePullMode(t *testing.T) {tests := []struct {name stringservice composetypes.ServiceConfig- expected ImagePullMode+ expected ImagePullStep}{{name: "default policy is missing",service: composetypes.ServiceConfig{},- expected: ImagePullModeIfMissing,+ expected: ImagePullStep{Mode: ImagePullModeIfMissing},},{name: "always policy",service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyAlways},- expected: ImagePullModeAlways,+ expected: ImagePullStep{Mode: ImagePullModeAlways},},{- name: "refresh policy",+ // bare "refresh" is not a spec value; compose-go resolves it to+ // missing, and compose v5.5.0 `up` follows that+ name: "bare refresh policy behaves as missing",service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyRefresh},- expected: ImagePullModeAlways,+ expected: ImagePullStep{Mode: ImagePullModeIfMissing},+ },+ {+ name: "daily policy is a 24h refresh window",+ service: composetypes.ServiceConfig{PullPolicy: "daily"},+ expected: ImagePullStep{Mode: ImagePullModeRefresh, RefreshAfter: 24 * time.Hour},+ },+ {+ name: "weekly policy is a 7d refresh window",+ service: composetypes.ServiceConfig{PullPolicy: "weekly"},+ expected: ImagePullStep{Mode: ImagePullModeRefresh, RefreshAfter: 7 * 24 * time.Hour},+ },+ {+ name: "every_12h policy parses its window",+ service: composetypes.ServiceConfig{PullPolicy: "every_12h"},+ expected: ImagePullStep{Mode: ImagePullModeRefresh, RefreshAfter: 12 * time.Hour},+ },+ {+ name: "every with invalid duration defaults to missing behavior",+ service: composetypes.ServiceConfig{PullPolicy: "every_bogus"},+ expected: ImagePullStep{Mode: ImagePullModeIfMissing},},{name: "missing policy",service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyMissing},- expected: ImagePullModeIfMissing,+ expected: ImagePullStep{Mode: ImagePullModeIfMissing},},{name: "if not present policy",service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyIfNotPresent},- expected: ImagePullModeIfMissing,+ expected: ImagePullStep{Mode: ImagePullModeIfMissing},},{name: "never policy",service: composetypes.ServiceConfig{PullPolicy: composetypes.PullPolicyNever},- expected: ImagePullModeNever,+ expected: ImagePullStep{Mode: ImagePullModeNever},},{name: "invalid policy defaults to missing behavior",service: composetypes.ServiceConfig{PullPolicy: "definitely_invalid"},- expected: ImagePullModeIfMissing,+ expected: ImagePullStep{Mode: ImagePullModeIfMissing},},}@@ -87,8 +110,48 @@ func TestBuildProjectImagePullPlan(t *testing.T) {plan := BuildImagePullPlan(project)assert.Len(t, plan, 2)- assert.Equal(t, ImagePullModeAlways, plan["redis:latest"])- assert.Equal(t, ImagePullModeNever, plan["nginx:latest"])+ assert.Equal(t, ImagePullStep{Mode: ImagePullModeAlways}, plan["redis:latest"])+ assert.Equal(t, ImagePullStep{Mode: ImagePullModeNever}, plan["nginx:latest"])+}++func TestBuildImagePullPlanRefreshMerge(t *testing.T) {+ project := &composetypes.Project{+ Name: "demo",+ Services: composetypes.Services{+ "daily": {+ Name: "daily",+ Image: "shared:latest",+ PullPolicy: "daily",+ },+ "hourly": {+ Name: "hourly",+ Image: "shared:latest",+ PullPolicy: "every_1h",+ },+ "missing": {+ Name: "missing",+ Image: "shared:latest",+ PullPolicy: composetypes.PullPolicyMissing,+ },+ "weekly": {+ Name: "weekly",+ Image: "other:latest",+ PullPolicy: "weekly",+ },+ "always": {+ Name: "always",+ Image: "other:latest",+ PullPolicy: composetypes.PullPolicyAlways,+ },+ },+ }++ plan := BuildImagePullPlan(project)++ // shortest refresh window wins over longer windows and pull-if-missing+ assert.Equal(t, ImagePullStep{Mode: ImagePullModeRefresh, RefreshAfter: time.Hour}, plan["shared:latest"])+ // always wins over any refresh window+ assert.Equal(t, ImagePullStep{Mode: ImagePullModeAlways}, plan["other:latest"])}func TestBuildImagePullPlanDependentImages(t *testing.T) {@@ -114,8 +177,8 @@ func TestBuildImagePullPlanDependentImages(t *testing.T) {plan := BuildImagePullPlan(project)- assert.Equal(t, ImagePullModeIfMissing, plan["busybox:stable"])- assert.Equal(t, ImagePullModeIfMissing, plan["content:latest"])+ assert.Equal(t, ImagePullStep{Mode: ImagePullModeIfMissing}, plan["busybox:stable"])+ assert.Equal(t, ImagePullStep{Mode: ImagePullModeIfMissing}, plan["content:latest"])assert.NotContains(t, plan, "skipped:hook")}@@ -158,4 +221,51 @@ func TestDecideDeployImageAction(t *testing.T) {assert.True(t, decision.RequireLocalOnly)assert.False(t, decision.PullAlways)})++ t.Run("refresh policy pulls when stale instead of always", func(t *testing.T) {+ svc := composetypes.ServiceConfig{PullPolicy: "daily"}+ decision := DecideDeployImageAction(svc, "")+ assert.True(t, decision.PullIfStale)+ assert.Equal(t, 24*time.Hour, decision.StaleAfter)+ assert.False(t, decision.PullAlways)+ })++ t.Run("refresh policy on build service pulls when stale", func(t *testing.T) {+ svc := composetypes.ServiceConfig{+ PullPolicy: "every_6h",+ Build: &composetypes.BuildConfig{Context: "."},+ }+ decision := DecideDeployImageAction(svc, "")+ assert.True(t, decision.PullIfStale)+ assert.Equal(t, 6*time.Hour, decision.StaleAfter)+ assert.False(t, decision.Build)+ })+}++func TestShouldPullDeployImage(t *testing.T) {+ refresh := DeployImageDecision{PullIfStale: true, StaleAfter: 24 * time.Hour}++ t.Run("always pulls regardless of presence", func(t *testing.T) {+ assert.True(t, ShouldPullDeployImage(DeployImageDecision{PullAlways: true}, true, time.Now()))+ })++ t.Run("missing image pulls under refresh policy", func(t *testing.T) {+ assert.True(t, ShouldPullDeployImage(refresh, false, time.Time{}))+ })++ t.Run("fresh image within window skips pull", func(t *testing.T) {+ assert.False(t, ShouldPullDeployImage(refresh, true, time.Now().Add(-time.Hour)))+ })++ t.Run("image older than window pulls", func(t *testing.T) {+ assert.True(t, ShouldPullDeployImage(refresh, true, time.Now().Add(-25*time.Hour)))+ })++ t.Run("unknown last-tag time counts as stale", func(t *testing.T) {+ assert.True(t, ShouldPullDeployImage(refresh, true, time.Time{}))+ })++ t.Run("pull-if-missing skips present image", func(t *testing.T) {+ assert.False(t, ShouldPullDeployImage(DeployImageDecision{PullIfMissing: true}, true, time.Time{}))+ })}diff --git a/backend/pkg/projects/service_selection.go b/backend/pkg/projects/service_selection.goindex 83b6dc6cc..476c152a6 100644--- a/backend/pkg/projects/service_selection.go+++ b/backend/pkg/projects/service_selection.go@@ -2,6 +2,7 @@ package projectsimport ("strings"+ "time"composetypes "github.com/compose-spec/compose-go/v2/types")@@ -56,9 +57,21 @@ func PrepareDeployServiceConfig(projectID, projectName, serviceName string, svc}// ShouldPullDeployImage reports whether a deploy must pull, given the resolved-// pull decision and whether the image is already present locally.-func ShouldPullDeployImage(decision DeployImageDecision, exists bool) bool {- return decision.PullAlways || (decision.PullIfMissing && !exists)+// pull decision, whether the image is already present locally, and when the+// local image was last tagged (zero when unknown). Refresh policies mirror+// compose v5.5.0's `up`: a present image is re-pulled only once its window+// has elapsed since the engine's last-tag time.+func ShouldPullDeployImage(decision DeployImageDecision, exists bool, lastTagged time.Time) bool {+ if decision.PullAlways {+ return true+ }+ if !exists {+ return decision.PullIfMissing || decision.PullIfStale+ }+ if decision.PullIfStale {+ return lastTagged.IsZero() || time.Now().After(lastTagged.Add(decision.StaleAfter))+ }+ return false}// SelectedImageRefs returns the distinct pullable image refs of the selecteddiff --git a/frontend/messages/en.json b/frontend/messages/en.jsonindex a3a9ae776..30704ab2e 100644--- a/frontend/messages/en.json+++ b/frontend/messages/en.json@@ -308,9 +308,9 @@"common_confirm_removal_message": "Are you sure you want to remove this {type}? This action is DESTRUCTIVE and cannot be undone.","common_confirm_destroy_message": "Are you sure you want to destroy this {type}? This action is DESTRUCTIVE and will remove associated resources and cannot be undone.","common_confirm_redeploy_title": "Confirm Redeploy",- "common_confirm_redeploy_message": "Are you sure you want to redeploy this project? This will pull the latest images and recreate the containers as needed.",+ "common_confirm_redeploy_message": "Are you sure you want to redeploy this project? This will pull the latest images and recreate any containers whose image or configuration changed. After an Arcane upgrade, the first redeploy may recreate all containers while image digests are re-evaluated.","container_confirm_redeploy_title": "Confirm Container Redeploy",- "container_confirm_redeploy_message": "Are you sure you want to redeploy this container? This will pull the latest image and recreate it as needed.",+ "container_confirm_redeploy_message": "Are you sure you want to redeploy this container? This will pull the latest image and recreate the container if its image or configuration changed.","container_redeploy_success": "Container redeployed successfully.","container_redeploy_failed": "Failed to redeploy container","confirm_remove_project_files_warning": "This will remove the project's files from disk.",@@ -2836,7 +2836,7 @@"deploy_force_recreate": "Force recreate containers","deploy_recreate_volumes": "Recreate changed volumes (data loss)","settings_default_deploy_pull_policy": "Default Deploy Pull Policy",- "settings_default_deploy_pull_policy_description": "Default image pull policy when deploying projects",+ "settings_default_deploy_pull_policy_description": "Default image pull policy when deploying projects. A pull_policy set per service in the compose file takes precedence, including refresh windows (daily, weekly, every_N).","authentication": "Authentication","authentication_description": "Configure authentication providers, password policy, and session behavior.","webhook_page_title": "Webhooks",