detached 20af812

feat(domain): add Created field to Container struct

Map container creation time from Docker API responses in both
ListContainers (unix timestamp) and InspectContainer (RFC3339Nano).
commit
20af81247e87e9dcfb54b07085ce40f060e8ebf1
author
brice · · 2026-03-24 08:31 UTC
committer
brice · · 2026-03-25 05:38 UTC
parent
e46f9aa
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
2 files · +7 -0
M internal/adapters/out/docker/runtime.go +4 -0
@@ -364,6 +364,7 @@ func (r *Runtime) ListContainers(ctx context.Context, all bool) ([]*domain.Conta
364364 Status: c.State, // Use State (e.g., "running") not Status (e.g., "Up 2 days")
365365 Ports: ports,
366366 Labels: c.Labels,
367+ Created: time.Unix(c.Created, 0),
367368 })
368369 }
369370
@@ -402,6 +403,8 @@ func (r *Runtime) InspectContainer(ctx context.Context, containerID string) (*do
402403 // Get container name (remove leading slash)
403404 name := strings.TrimPrefix(resp.Name, "/")
404405
406+ created, _ := time.Parse(time.RFC3339Nano, resp.Created)
407+
405408 return &domain.Container{
406409 ID: resp.ID,
407410 Image: resp.Config.Image,
@@ -411,6 +414,7 @@ func (r *Runtime) InspectContainer(ctx context.Context, containerID string) (*do
411414 ExitCode: resp.State.ExitCode,
412415 Ports: ports,
413416 Labels: resp.Config.Labels,
417+ Created: created,
414418 }, nil
415419 }
416420
@@ -364,6 +364,7 @@ func (r *Runtime) ListContainers(ctx context.Context, all bool) ([]*domain.Conta
364 Status: c.State, // Use State (e.g., "running") not Status (e.g., "Up 2 days")364 Status: c.State, // Use State (e.g., "running") not Status (e.g., "Up 2 days")
365 Ports: ports,365 Ports: ports,
366 Labels: c.Labels,366 Labels: c.Labels,
367+ Created: time.Unix(c.Created, 0),
367 })368 })
368 }369 }
369 370
@@ -402,6 +403,8 @@ func (r *Runtime) InspectContainer(ctx context.Context, containerID string) (*do
402 // Get container name (remove leading slash)403 // Get container name (remove leading slash)
403 name := strings.TrimPrefix(resp.Name, "/")404 name := strings.TrimPrefix(resp.Name, "/")
404 405
406+ created, _ := time.Parse(time.RFC3339Nano, resp.Created)
407+
405 return &domain.Container{408 return &domain.Container{
406 ID: resp.ID,409 ID: resp.ID,
407 Image: resp.Config.Image,410 Image: resp.Config.Image,
@@ -411,6 +414,7 @@ func (r *Runtime) InspectContainer(ctx context.Context, containerID string) (*do
411 ExitCode: resp.State.ExitCode,414 ExitCode: resp.State.ExitCode,
412 Ports: ports,415 Ports: ports,
413 Labels: resp.Config.Labels,416 Labels: resp.Config.Labels,
417+ Created: created,
414 }, nil418 }, nil
415 }419 }
416 420
M internal/domain/container.go +3 -0
@@ -2,6 +2,8 @@
22 // These types are used throughout the application and have no tags or framework dependencies.
33 package domain
44
5+import "time"
6+
57 // Container represents a running container in the system.
68 type Container struct {
79 ID string
@@ -12,6 +14,7 @@ type Container struct {
1214 ExitCode int
1315 Ports []int
1416 Labels map[string]string
17+ Created time.Time
1518 }
1619
1720 // NetworkInfo represents network configuration and state.
@@ -2,6 +2,8 @@
2 // These types are used throughout the application and have no tags or framework dependencies.2 // These types are used throughout the application and have no tags or framework dependencies.
3 package domain3 package domain
4 4
5+import "time"
6+
5 // Container represents a running container in the system.7 // Container represents a running container in the system.
6 type Container struct {8 type Container struct {
7 ID string9 ID string
@@ -12,6 +14,7 @@ type Container struct {
12 ExitCode int14 ExitCode int
13 Ports []int15 Ports []int
14 Labels map[string]string16 Labels map[string]string
17+ Created time.Time
15 }18 }
16 19
17 // NetworkInfo represents network configuration and state.20 // NetworkInfo represents network configuration and state.

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close