MCPcopy Create free account
hub / github.com/codename-co/stack / Container

Function Container

packages/app/src/models/Container.ts:4–31  ·  view source on GitHub ↗
(container: DockerContainer)

Source from the content-addressed store, hash-verified

2import { Network } from "./Network";
3
4export const Container = (container: DockerContainer) => {
5 return {
6 ...container,
7
8 get stack(): string {
9 return this.Labels["com.docker.compose.project"];
10 },
11
12 get name(): string {
13 return (
14 this.Labels["stack.name"] ||
15 this.Labels["dash.name"] ||
16 this.Names[0].replace(new RegExp(`^/${this.stack}-`), "")
17 );
18 },
19
20 get desc(): string | undefined {
21 return this.Labels["stack.desc"] || this.Labels["dash.desc"] || undefined;
22 },
23
24 get belongsToNetworks() {
25 return (networks?: Network[]) =>
26 Object.keys(this.NetworkSettings.Networks).every((networkName) =>
27 networks?.some((network) => network.Name === networkName)
28 );
29 },
30 };
31};
32
33export type Container = ReturnType<typeof Container>;
34

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected