mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge 9fb6ca2b3b
into 2a89be6efc
This commit is contained in:
commit
1786e38cc5
@ -124,6 +124,26 @@ export const initializeTraefik = async ({
|
|||||||
console.log("No existing container to remove");
|
console.log("No existing container to remove");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
await docker.getImage(imageName).inspect();
|
||||||
|
console.log(`Image ${imageName} already exists locally.`);
|
||||||
|
} catch (error: any) {
|
||||||
|
if (error?.statusCode === 404) {
|
||||||
|
console.log(`Image ${imageName} not found, pulling...`);
|
||||||
|
const stream = await docker.pull(imageName);
|
||||||
|
await new Promise((resolve, reject) => {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
|
// @ts-ignore
|
||||||
|
docker.modem.followProgress(stream, (err: Error, res: any) =>
|
||||||
|
err ? reject(err) : resolve(res),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
console.log(`Image ${imageName} pulled successfully.`);
|
||||||
|
} else {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create and start the new container
|
// Create and start the new container
|
||||||
try {
|
try {
|
||||||
await docker.createContainer(settings);
|
await docker.createContainer(settings);
|
||||||
|
Loading…
Reference in New Issue
Block a user