Skip to content

Commit 6ba3505

Browse files
author
Mauricio Siu
committed
fix: update getServiceImageDigest to retrieve image digest more reliably
- Refactored the getServiceImageDigest function to use a more robust command for fetching the Docker service image digest, improving accuracy. - Added console logging for the current digest to aid in debugging and monitoring.
1 parent 46d1809 commit 6ba3505

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/server/src/services/settings.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ export const pullLatestRelease = async () => {
4242
/** Returns Dokploy docker service image digest */
4343
export const getServiceImageDigest = async () => {
4444
const { stdout } = await execAsync(
45-
"docker service inspect dokploy --format '{{.Spec.TaskTemplate.ContainerSpec.Image}}'",
45+
`docker image ls --digests --format '{{.Repository}}:{{.Tag}} {{.Digest}}' | \
46+
grep "$(docker service inspect dokploy --format '{{.Spec.TaskTemplate.ContainerSpec.Image}}')" | \
47+
awk '{print $2}' | \
48+
awk -F':' '{print $2}'`,
4649
);
4750

4851
const currentDigest = stdout.trim().split("@")[1];
52+
console.log("currentDigest: ", currentDigest);
4953

5054
if (!currentDigest) {
5155
throw new Error("Could not get current service image digest");

0 commit comments

Comments
 (0)