Format a numeric duration in human-readable text (short, medium, long, JSON, or tabular format).
234
The ralflorent/duration Docker image packages the Go CLI as a single static binary on a minimal base image. It supports linux/amd64 and linux/arm64.
docker pull ralflorent/duration
docker run --rm ralflorent/duration 5400000
# => 1h 30m
Arguments are passed directly to the duration CLI:
# Short format (default)
docker run --rm ralflorent/duration 3600
# => 3s 600ms
# Medium format, value in seconds
docker run --rm ralflorent/duration -m --unit=s 3600
# => 1 hr
# Long format
docker run --rm ralflorent/duration -l --unit=m 90
# => 1 hour 30 minutes
# JSON output
docker run --rm ralflorent/duration --json 7200000
# => { "milliseconds": 7200000, "seconds": 7200, ... }
# Table output
docker run --rm ralflorent/duration --table --unit=s 3600 7200
# Multiple values
docker run --rm ralflorent/duration -m 60000 120000
# => 1 min
# => 2 mins
The DURATION_UNIT environment variable is also supported:
docker run --rm -e DURATION_UNIT=s ralflorent/duration -m 3600
# => 1 hr
docker run --rm ralflorent/duration --version
The version printed matches the value baked in at build time via the VERSION build argument (see below). Published images use the same version as the corresponding Git tag and npm release.
Published images are available for:
linux/amd64linux/arm64Docker automatically pulls the correct variant for your host architecture.
gcr.io/distroless/static-debian12:nonroot — no shell, no package manager, non-root user./duration; all arguments are forwarded to the CLI.docker build -t duration:local .
docker run --rm duration:local -m --unit=s 3600
To set a specific version:
docker build --build-arg VERSION=1.3.2 -t duration:local .
nonroot UID 65534).docker pull ralflorent/duration@sha256:<digest>
Content type
Image
Digest
sha256:e8e2c86e0…
Size
1.3 MB
Last updated
5 months ago
docker pull ralflorent/duration