Skip to content

Commit ddb7073

Browse files
committed
compute default labels at install
1 parent d247daf commit ddb7073

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

packages/dockerCompose/src/userSettings.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import path from "path";
2-
import { mapValues, pick, omitBy, isObject } from "lodash-es";
2+
import { mapValues, omitBy, isObject } from "lodash-es";
33
import {
44
parsePortMappings,
55
stringifyPortMappings,
@@ -238,7 +238,14 @@ export function applyUserSettings(
238238

239239
const nextLabels = {
240240
...(service.labels || {}),
241-
...writeDefaultsToLabels(pick(service, ["environment", "ports", "volumes"]))
241+
// Compute default labels from post-applied values so they match the
242+
// compose content written to disk. This keeps the daemon idempotent:
243+
// re-computing labels from the same on-disk values yields no diff.
244+
...writeDefaultsToLabels({
245+
environment: nextEnvironment,
246+
ports: nextPorts,
247+
volumes: nextServiceVolumes
248+
})
242249
};
243250

244251
return {

0 commit comments

Comments
 (0)