Browse Source

Merge pull request #26534 from allencloud/better-checkpoint

change code and fix docs about checkpoint
Brian Goff 8 years ago
parent
commit
047400c64c

+ 1 - 1
api/server/router/checkpoint/checkpoint_routes.go

@@ -28,7 +28,7 @@ func (s *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.R
 		return err
 	}
 
-	w.WriteHeader(http.StatusNoContent)
+	w.WriteHeader(http.StatusCreated)
 	return nil
 }
 

+ 3 - 4
daemon/checkpoint.go

@@ -42,13 +42,13 @@ func (daemon *Daemon) CheckpointDelete(name string, checkpoint string) error {
 	return os.RemoveAll(filepath.Join(checkpointDir, checkpoint))
 }
 
-// CheckpointList deletes the specified checkpoint
+// CheckpointList lists all checkpoints of the specified container
 func (daemon *Daemon) CheckpointList(name string) ([]types.Checkpoint, error) {
-	response := []types.Checkpoint{}
+	var out []types.Checkpoint
 
 	container, err := daemon.GetContainer(name)
 	if err != nil {
-		return response, err
+		return nil, err
 	}
 
 	checkpointDir := container.CheckpointDir()
@@ -61,7 +61,6 @@ func (daemon *Daemon) CheckpointList(name string) ([]types.Checkpoint, error) {
 		return nil, err
 	}
 
-	var out []types.Checkpoint
 	for _, d := range dirs {
 		if !d.IsDir() {
 			continue

+ 3 - 3
experimental/checkpoint-restore.md

@@ -35,7 +35,7 @@ not optimized for the task).
 
 ## Using Checkpoint & Restore
 
-A new top level commands `docker checkpoint` is introduced, with three subcommands:
+A new top level command `docker checkpoint` is introduced, with three subcommands:
 - `create` (creates a new checkpoint)
 - `ls` (lists existing checkpoints)
 - `rm` (deletes an existing checkpoint)
@@ -44,9 +44,9 @@ Additionally, a `--checkpoint` flag is added to the container start command.
 
 The options for checkpoint create:
 
-    Usage:  docker checkpoint [OPTIONS] CONTAINER CHECKPOINT_ID
+    Usage:  docker checkpoint create [OPTIONS] CONTAINER CHECKPOINT
 
-    Checkpoint the specified container
+    Create a checkpoint from a running container
 
       --leave-running=false    leave the container running after checkpoint