mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-07-09 21:17:09 +08:00
commands: implementation for inspect
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
@ -153,7 +153,7 @@ func (d *Driver) Info(ctx context.Context) (*driver.Info, error) {
|
||||
if err != nil {
|
||||
if dockerclient.IsErrNotFound(err) {
|
||||
return &driver.Info{
|
||||
Status: driver.Terminated,
|
||||
Status: driver.Inactive,
|
||||
}, nil
|
||||
}
|
||||
return nil, err
|
||||
@ -186,7 +186,7 @@ func (d *Driver) Rm(ctx context.Context, force bool) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if info.Status != driver.Terminated {
|
||||
if info.Status != driver.Inactive {
|
||||
return d.DockerAPI.ContainerRemove(ctx, d.Name, dockertypes.ContainerRemoveOptions{
|
||||
RemoveVolumes: true,
|
||||
Force: true,
|
||||
|
@ -10,18 +10,34 @@ import (
|
||||
)
|
||||
|
||||
var ErrNotRunning = errors.Errorf("driver not running")
|
||||
var ErrNotConnecting = errors.Errorf("driver not connection")
|
||||
var ErrNotConnecting = errors.Errorf("driver not connecting")
|
||||
|
||||
type Status int
|
||||
|
||||
const (
|
||||
Terminated Status = iota
|
||||
Inactive Status = iota
|
||||
Starting
|
||||
Running
|
||||
Stopping
|
||||
Stopped
|
||||
)
|
||||
|
||||
func (s Status) String() string {
|
||||
switch s {
|
||||
case Inactive:
|
||||
return "inactive"
|
||||
case Starting:
|
||||
return "starting"
|
||||
case Running:
|
||||
return "running"
|
||||
case Stopping:
|
||||
return "stopping"
|
||||
case Stopped:
|
||||
return "stopped"
|
||||
}
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
type Info struct {
|
||||
Status Status
|
||||
}
|
||||
|
Reference in New Issue
Block a user