mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
49e61f62ce
This is part of an effort to break apart the deprecated server/ package Docker-DCO-1.1-Signed-off-by: Solomon Hykes <solomon@docker.com> (github: shykes) Fix issues with renaming changes to container_changes Docker-DCO-1.1-Signed-off-by: Tibor Vass <teabee89@gmail.com> (github: tiborvass)
32 lines
751 B
Go
32 lines
751 B
Go
package daemon
|
|
|
|
import (
|
|
"github.com/docker/docker/engine"
|
|
)
|
|
|
|
func (daemon *Daemon) ContainerChanges(job *engine.Job) engine.Status {
|
|
if n := len(job.Args); n != 1 {
|
|
return job.Errorf("Usage: %s CONTAINER", job.Name)
|
|
}
|
|
name := job.Args[0]
|
|
if container := daemon.Get(name); container != nil {
|
|
outs := engine.NewTable("", 0)
|
|
changes, err := container.Changes()
|
|
if err != nil {
|
|
return job.Error(err)
|
|
}
|
|
for _, change := range changes {
|
|
out := &engine.Env{}
|
|
if err := out.Import(change); err != nil {
|
|
return job.Error(err)
|
|
}
|
|
outs.Add(out)
|
|
}
|
|
if _, err := outs.WriteListTo(job.Stdout); err != nil {
|
|
return job.Error(err)
|
|
}
|
|
} else {
|
|
return job.Errorf("No such container: %s", name)
|
|
}
|
|
return engine.StatusOK
|
|
}
|