♻️ Change Docker instance to singleton

This commit is contained in:
Noan
2022-08-23 18:58:10 +02:00
parent 48a5b4d4fd
commit dccfe7e2e3
3 changed files with 23 additions and 5 deletions

View File

@@ -1,10 +1,9 @@
import { NextApiRequest, NextApiResponse } from 'next';
import Docker from 'dockerode';
import DockerSingleton from './DockerSingleton';
async function Get(req: NextApiRequest, res: NextApiResponse) {
try {
const docker = new Docker();
const docker = DockerSingleton.getInstance();
const containers = await docker.listContainers({ all: true });
res.status(200).json(containers);
} catch (err) {