| ... | ... |
@@ -472,7 +472,7 @@ func (srv *Server) CmdImport(stdin io.ReadCloser, stdout rcli.DockerConn, args . |
| 472 | 472 |
} |
| 473 | 473 |
archive = ProgressReader(resp.Body, int(resp.ContentLength), stdout) |
| 474 | 474 |
} |
| 475 |
- img, err := srv.runtime.graph.Create(archive, nil, "Imported from "+src) |
|
| 475 |
+ img, err := srv.runtime.graph.Create(archive, nil, "Imported from "+src, "") |
|
| 476 | 476 |
if err != nil {
|
| 477 | 477 |
return err |
| 478 | 478 |
} |
| ... | ... |
@@ -727,7 +727,7 @@ func (srv *Server) CmdCommit(stdin io.ReadCloser, stdout io.Writer, args ...stri |
| 727 | 727 |
cmd.Usage() |
| 728 | 728 |
return nil |
| 729 | 729 |
} |
| 730 |
- img, err := srv.runtime.Commit(containerName, repository, tag, *flComment) |
|
| 730 |
+ img, err := srv.runtime.Commit(containerName, repository, tag, *flComment, "") |
|
| 731 | 731 |
if err != nil {
|
| 732 | 732 |
return err |
| 733 | 733 |
} |
| ... | ... |
@@ -182,7 +182,7 @@ func TestCommitRun(t *testing.T) {
|
| 182 | 182 |
if err != nil {
|
| 183 | 183 |
t.Error(err) |
| 184 | 184 |
} |
| 185 |
- img, err := runtime.graph.Create(rwTar, container1, "unit test commited image") |
|
| 185 |
+ img, err := runtime.graph.Create(rwTar, container1, "unit test commited image", "") |
|
| 186 | 186 |
if err != nil {
|
| 187 | 187 |
t.Error(err) |
| 188 | 188 |
} |
| ... | ... |
@@ -83,12 +83,13 @@ func (graph *Graph) Get(name string) (*Image, error) {
|
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
// Create creates a new image and registers it in the graph. |
| 86 |
-func (graph *Graph) Create(layerData Archive, container *Container, comment string) (*Image, error) {
|
|
| 86 |
+func (graph *Graph) Create(layerData Archive, container *Container, comment, author string) (*Image, error) {
|
|
| 87 | 87 |
img := &Image{
|
| 88 | 88 |
Id: GenerateId(), |
| 89 | 89 |
Comment: comment, |
| 90 | 90 |
Created: time.Now(), |
| 91 | 91 |
DockerVersion: VERSION, |
| 92 |
+ Author: author, |
|
| 92 | 93 |
} |
| 93 | 94 |
if container != nil {
|
| 94 | 95 |
img.Parent = container.Image |
| ... | ... |
@@ -62,7 +62,7 @@ func TestGraphCreate(t *testing.T) {
|
| 62 | 62 |
if err != nil {
|
| 63 | 63 |
t.Fatal(err) |
| 64 | 64 |
} |
| 65 |
- image, err := graph.Create(archive, nil, "Testing") |
|
| 65 |
+ image, err := graph.Create(archive, nil, "Testing", "") |
|
| 66 | 66 |
if err != nil {
|
| 67 | 67 |
t.Fatal(err) |
| 68 | 68 |
} |
| ... | ... |
@@ -122,7 +122,7 @@ func TestMount(t *testing.T) {
|
| 122 | 122 |
if err != nil {
|
| 123 | 123 |
t.Fatal(err) |
| 124 | 124 |
} |
| 125 |
- image, err := graph.Create(archive, nil, "Testing") |
|
| 125 |
+ image, err := graph.Create(archive, nil, "Testing", "") |
|
| 126 | 126 |
if err != nil {
|
| 127 | 127 |
t.Fatal(err) |
| 128 | 128 |
} |
| ... | ... |
@@ -166,7 +166,7 @@ func createTestImage(graph *Graph, t *testing.T) *Image {
|
| 166 | 166 |
if err != nil {
|
| 167 | 167 |
t.Fatal(err) |
| 168 | 168 |
} |
| 169 |
- img, err := graph.Create(archive, nil, "Test image") |
|
| 169 |
+ img, err := graph.Create(archive, nil, "Test image", "") |
|
| 170 | 170 |
if err != nil {
|
| 171 | 171 |
t.Fatal(err) |
| 172 | 172 |
} |
| ... | ... |
@@ -181,7 +181,7 @@ func TestDelete(t *testing.T) {
|
| 181 | 181 |
t.Fatal(err) |
| 182 | 182 |
} |
| 183 | 183 |
assertNImages(graph, t, 0) |
| 184 |
- img, err := graph.Create(archive, nil, "Bla bla") |
|
| 184 |
+ img, err := graph.Create(archive, nil, "Bla bla", "") |
|
| 185 | 185 |
if err != nil {
|
| 186 | 186 |
t.Fatal(err) |
| 187 | 187 |
} |
| ... | ... |
@@ -192,11 +192,11 @@ func TestDelete(t *testing.T) {
|
| 192 | 192 |
assertNImages(graph, t, 0) |
| 193 | 193 |
|
| 194 | 194 |
// Test 2 create (same name) / 1 delete |
| 195 |
- img1, err := graph.Create(archive, nil, "Testing") |
|
| 195 |
+ img1, err := graph.Create(archive, nil, "Testing", "") |
|
| 196 | 196 |
if err != nil {
|
| 197 | 197 |
t.Fatal(err) |
| 198 | 198 |
} |
| 199 |
- if _, err = graph.Create(archive, nil, "Testing"); err != nil {
|
|
| 199 |
+ if _, err = graph.Create(archive, nil, "Testing", ""); err != nil {
|
|
| 200 | 200 |
t.Fatal(err) |
| 201 | 201 |
} |
| 202 | 202 |
assertNImages(graph, t, 2) |
| ... | ... |
@@ -23,6 +23,7 @@ type Image struct {
|
| 23 | 23 |
Container string `json:"container,omitempty"` |
| 24 | 24 |
ContainerConfig Config `json:"container_config,omitempty"` |
| 25 | 25 |
DockerVersion string `json:"docker_version,omitempty"` |
| 26 |
+ Author string `json:"author,omitempty"` |
|
| 26 | 27 |
graph *Graph |
| 27 | 28 |
} |
| 28 | 29 |
|
| ... | ... |
@@ -238,7 +238,7 @@ func (runtime *Runtime) Destroy(container *Container) error {
|
| 238 | 238 |
|
| 239 | 239 |
// Commit creates a new filesystem image from the current state of a container. |
| 240 | 240 |
// The image can optionally be tagged into a repository |
| 241 |
-func (runtime *Runtime) Commit(id, repository, tag, comment string) (*Image, error) {
|
|
| 241 |
+func (runtime *Runtime) Commit(id, repository, tag, comment, author string) (*Image, error) {
|
|
| 242 | 242 |
container := runtime.Get(id) |
| 243 | 243 |
if container == nil {
|
| 244 | 244 |
return nil, fmt.Errorf("No such container: %s", id)
|
| ... | ... |
@@ -250,7 +250,7 @@ func (runtime *Runtime) Commit(id, repository, tag, comment string) (*Image, err |
| 250 | 250 |
return nil, err |
| 251 | 251 |
} |
| 252 | 252 |
// Create a new image from the container's base layers + a new layer from container changes |
| 253 |
- img, err := runtime.graph.Create(rwTar, container, comment) |
|
| 253 |
+ img, err := runtime.graph.Create(rwTar, container, comment, author) |
|
| 254 | 254 |
if err != nil {
|
| 255 | 255 |
return nil, err |
| 256 | 256 |
} |