Add json storage for container storage

This is just a temporary storage solution to get
containers running on the new code.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
Derek McGowan
2017-05-23 13:00:30 -07:00
parent 539742881d
commit e1ed4a2ea4
6 changed files with 118 additions and 11 deletions

View File

@@ -65,18 +65,23 @@ var listCommand = cli.Command{
w := tabwriter.NewWriter(os.Stdout, 10, 1, 3, ' ', 0)
fmt.Fprintln(w, "ID\tIMAGE\tPID\tSTATUS")
for _, c := range response.Containers {
var status string
var (
status string
pid uint32
)
task, ok := tasksByContainerID[c.ID]
if ok {
status = task.Status.String()
pid = task.Pid
} else {
status = "STOPPED" // TODO(stevvooe): Is this assumption correct?
pid = 0
}
if _, err := fmt.Fprintf(w, "%s\t%s\t%d\t%s\n",
c.ID,
c.Image,
task.Pid,
pid,
status,
); err != nil {
return err