mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #26534 from allencloud/better-checkpoint
change code and fix docs about checkpoint
This commit is contained in:
commit
047400c64c
3 changed files with 7 additions and 8 deletions
|
@ -28,7 +28,7 @@ func (s *checkpointRouter) postContainerCheckpoint(ctx context.Context, w http.R
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusCreated)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,13 +42,13 @@ func (daemon *Daemon) CheckpointDelete(name string, checkpoint string) error {
|
||||||
return os.RemoveAll(filepath.Join(checkpointDir, checkpoint))
|
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) {
|
func (daemon *Daemon) CheckpointList(name string) ([]types.Checkpoint, error) {
|
||||||
response := []types.Checkpoint{}
|
var out []types.Checkpoint
|
||||||
|
|
||||||
container, err := daemon.GetContainer(name)
|
container, err := daemon.GetContainer(name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return response, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
checkpointDir := container.CheckpointDir()
|
checkpointDir := container.CheckpointDir()
|
||||||
|
@ -61,7 +61,6 @@ func (daemon *Daemon) CheckpointList(name string) ([]types.Checkpoint, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var out []types.Checkpoint
|
|
||||||
for _, d := range dirs {
|
for _, d := range dirs {
|
||||||
if !d.IsDir() {
|
if !d.IsDir() {
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -35,7 +35,7 @@ not optimized for the task).
|
||||||
|
|
||||||
## Using Checkpoint & Restore
|
## 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)
|
- `create` (creates a new checkpoint)
|
||||||
- `ls` (lists existing checkpoints)
|
- `ls` (lists existing checkpoints)
|
||||||
- `rm` (deletes an existing checkpoint)
|
- `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:
|
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
|
--leave-running=false leave the container running after checkpoint
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue