Back to list

Docker-style Container Config

Lv.5643@mukitaro10 playsDec 28, 2025

Container configuration structures inspired by Docker. Go's flagship project.

preview.go
Go
1package container
2
3import (
4 "context"
5 "io"
6)
7
8type Config struct {
9 Hostname string
10 Domainname string
11 User string
12 Env []string
13 Cmd []string
14 Image string
15 WorkingDir string
16 Labels map[string]string
17}
18
19type Container struct {
20 ID string
21 Config *Config
22 State *State
23 Created int64
24}
25
26type State struct {
27 Running bool
28 Paused bool
29 Pid int
30 ExitCode int
31 StartedAt string
32 FinishedAt string
33}
34
35func (c *Container) Start(ctx context.Context) error {
36 c.State.Running = true
37 return nil
38}
39
40func (c *Container) Stop(ctx context.Context) error {
41 c.State.Running = false
42 return nil
43}

Custom problems are not included in rankings