mirror of
https://github.com/andwati/dokploy.git
synced 2026-10-31 09:12:15 +00:00
fix: if a build or pull operation is running during docker cleaning, pause the cleaning
This commit is contained in:
@@ -227,20 +227,56 @@ export const cleanupFullDocker = async (serverId?: string | null) => {
|
|||||||
await execAsyncRemote(
|
await execAsyncRemote(
|
||||||
serverId,
|
serverId,
|
||||||
`
|
`
|
||||||
${cleanupImages}
|
CHECK_INTERVAL=10
|
||||||
${cleanupVolumes}
|
|
||||||
${cleanupContainers}
|
echo "Starting Docker cleanup..."
|
||||||
${cleanupSystem}
|
|
||||||
${cleanupBuilder}
|
while true; do
|
||||||
|
PROCESSES=$(ps aux | grep -E "docker build|docker pull" | grep -v grep)
|
||||||
|
|
||||||
|
if [ -z "$PROCESSES" ]; then
|
||||||
|
echo "Docker is idle. Starting cleanup..."
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Docker is busy. Will check again in $CHECK_INTERVAL seconds..."
|
||||||
|
sleep $CHECK_INTERVAL
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
${cleanupImages}
|
||||||
|
${cleanupVolumes}
|
||||||
|
${cleanupContainers}
|
||||||
|
${cleanupSystem}
|
||||||
|
${cleanupBuilder}
|
||||||
|
|
||||||
|
echo "Docker cleanup completed."
|
||||||
`,
|
`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
await execAsync(`
|
await execAsync(`
|
||||||
${cleanupImages}
|
CHECK_INTERVAL=10
|
||||||
${cleanupVolumes}
|
|
||||||
${cleanupContainers}
|
echo "Starting Docker cleanup..."
|
||||||
${cleanupSystem}
|
|
||||||
${cleanupBuilder}
|
while true; do
|
||||||
|
PROCESSES=$(ps aux | grep -E "docker build|docker pull" | grep -v grep)
|
||||||
|
|
||||||
|
if [ -z "$PROCESSES" ]; then
|
||||||
|
echo "Docker is idle. Starting cleanup..."
|
||||||
|
break
|
||||||
|
else
|
||||||
|
echo "Docker is busy. Will check again in $CHECK_INTERVAL seconds..."
|
||||||
|
sleep $CHECK_INTERVAL
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
${cleanupImages}
|
||||||
|
${cleanupVolumes}
|
||||||
|
${cleanupContainers}
|
||||||
|
${cleanupSystem}
|
||||||
|
${cleanupBuilder}
|
||||||
|
|
||||||
|
echo "Docker cleanup completed."
|
||||||
`);
|
`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user