This commit is contained in:
Andras Bacsai 2022-12-06 10:29:14 +01:00
parent b45ad19732
commit dcb29a80fe

View File

@ -335,6 +335,7 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
traefik.http.services = { ...traefik.http.services, ...generateServices(serviceId, id, port) }
if (previews) {
const { stdout } = await executeCommand({ dockerId, command: `docker container ls --filter="status=running" --filter="network=${network}" --filter="name=${id}-" --format="{{json .Names}}"` })
if (stdout) {
const containers = stdout
.trim()
.split('\n')
@ -351,6 +352,7 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
}
}
}
}
} catch (error) {
console.log(error)
}
@ -362,11 +364,13 @@ export async function proxyConfiguration(request: FastifyRequest<OnlyId>, remote
services.forEach((app) => dockerIds.add(app.destinationDocker.id));
for (const dockerId of dockerIds) {
const { stdout: container } = await executeCommand({ dockerId, command: `docker container ls --filter 'label=coolify.managed=true' --format '{{ .Names}}'` })
if (container) {
const containersArray = container.trim().split('\n');
if (containersArray.length > 0) {
runningContainers[dockerId] = containersArray
}
}
}
for (const service of services) {
try {
let {