Skip to content

Commit

Permalink
show ip
Browse files Browse the repository at this point in the history
  • Loading branch information
kla committed Nov 29, 2024
1 parent dd12113 commit bcf8c9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function name(app: App, container: Container) {
}

export default function list(apps: App[], options: { fields?: string[] } = {}) {
const head = ['', 'App', 'Status', 'Uptime', 'Forwarding', 'Source'].concat(options.fields || [])
const head = ['', 'App', 'Status', 'Uptime', 'Forwarding', 'IP', 'Source'].concat(options.fields || [])
const table = new Table({
head: head,
style: { head: ['cyan'] },
Expand All @@ -38,6 +38,7 @@ export default function list(apps: App[], options: { fields?: string[] } = {}) {
container.state,
container.uptime?.replace(' ago', ''),
container.forwardedPorts.join(', '),
container.ipAddresses.join(', '),
app.containers.length == 1 ? source : '',
]

Expand Down
4 changes: 4 additions & 0 deletions src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export default class Container {
return [...new Set(ports)]
}

get ipAddresses(): string[] {
return (Object.values(this.attributes.NetworkSettings?.Networks) || []).map(network => network['IPAddress'])
}

async down() {
return docker.compose(this.context, `stop ${this.name}`, this.composeFile)
}
Expand Down

0 comments on commit bcf8c9b

Please sign in to comment.