github.com/fcwu/docker@v1.4.2-0.20150115145920-2a69ca89f0df/daemon/changes.go (about) 1 package daemon 2 3 import ( 4 "github.com/docker/docker/engine" 5 ) 6 7 func (daemon *Daemon) ContainerChanges(job *engine.Job) engine.Status { 8 if n := len(job.Args); n != 1 { 9 return job.Errorf("Usage: %s CONTAINER", job.Name) 10 } 11 name := job.Args[0] 12 if container := daemon.Get(name); container != nil { 13 outs := engine.NewTable("", 0) 14 changes, err := container.Changes() 15 if err != nil { 16 return job.Error(err) 17 } 18 for _, change := range changes { 19 out := &engine.Env{} 20 if err := out.Import(change); err != nil { 21 return job.Error(err) 22 } 23 outs.Add(out) 24 } 25 if _, err := outs.WriteListTo(job.Stdout); err != nil { 26 return job.Error(err) 27 } 28 } else { 29 return job.Errorf("No such container: %s", name) 30 } 31 return engine.StatusOK 32 }