Show image download size as human-readable approximation

Signed-off-by: Han Verstraete <welteki@pm.me>
This commit is contained in:
Han Verstraete
2022-04-02 08:15:44 +00:00
committed by Alex Ellis
parent 4b132315c7
commit e09f37e5cb
3 changed files with 4 additions and 1 deletions

View File

@ -24,6 +24,7 @@ import (
"github.com/pkg/errors"
"github.com/containerd/containerd/namespaces"
units "github.com/docker/go-units"
"github.com/opencontainers/runtime-spec/specs-go"
)
@ -112,7 +113,7 @@ func (s *Supervisor) Start(svcs []Service) error {
}
images[svc.Name] = img
size, _ := img.Size(ctx)
fmt.Printf("Prepare done for: %s, %d bytes\n", svc.Image, size)
fmt.Printf("Prepare done for: %s, %s\n", svc.Image, units.HumanSize(float64(size)))
}
for _, svc := range svcs {