( appName: string, serverId?: string | null, )
| 724 | }; |
| 725 | |
| 726 | export const getServiceContainer = async ( |
| 727 | appName: string, |
| 728 | serverId?: string | null, |
| 729 | ) => { |
| 730 | try { |
| 731 | const filter = { |
| 732 | status: ["running"], |
| 733 | label: [`com.docker.swarm.service.name=${appName}`], |
| 734 | }; |
| 735 | const remoteDocker = await getRemoteDocker(serverId); |
| 736 | const containers = await remoteDocker.listContainers({ |
| 737 | filters: JSON.stringify(filter), |
| 738 | }); |
| 739 | |
| 740 | if (containers.length === 0 || !containers[0]) { |
| 741 | return null; |
| 742 | } |
| 743 | |
| 744 | const container = containers[0]; |
| 745 | |
| 746 | return container; |
| 747 | } catch (error) { |
| 748 | throw error; |
| 749 | } |
| 750 | }; |
| 751 | |
| 752 | export const getComposeContainer = async ( |
| 753 | compose: Compose, |
no test coverage detected