Repository navigation
runlike 2.0.0 is a rewrite in Go. It has the same command line as 1.x. The
command it prints is quoted safely and covers every docker run option.
Summary
- Covers all 103 options of
docker runin Docker CLI v29.9.3. 95 are
reproduced, 3 are folded into other options, and 5 are client-only, so
Docker never stores them. Each option is listed with its status in
docs/options.md. - Every option is tested by a round trip on a real Docker Engine 29.9.3,
for Linux and for Windows containers: the tests create a container,
recreate it from runlike's output and compare bothdocker inspect
outputs. - Downloads: static binaries for Linux (amd64, arm64), macOS (Apple
Silicon) and Windows (amd64, arm64), withSHA256SUMS. The Docker image
assaflavie/runlike:2.0.0is built for linux/amd64 and linux/arm64. You
can also install it with
go install github.com/lavie/runlike/v2/cmd/runlike@v2.0.0.
Changes from 1.x
- Every value is quoted safely. In 1.x, spaces, quotes or
$in a value
could break the printed command or change what it does. The quoting is
fuzz-tested in sh, bash, zsh and dash, including EUC locales. Run the
output witheval "$(runlike NAME)", not a bare$(runlike NAME). - New
--shell powershell|cmdprints the command for PowerShell 7.3 or
later, or forcmd.exe. - Options are printed as
--flag=value, one argument each. - Defaults are left out. A value is left out only when it equals Docker's
built-in default or the image's own value. A default that your daemon sets
itself (for example Docker Desktop'slocallog driver) is printed, so the
copy is the same on any daemon. - Named volumes are always kept. Mounts keep the form they were made with
(-vor--mount) and their options. Anonymous volumes that the image
declares are no longer printed. - All networks are kept, with their aliases, static IPs and per-network
settings. - MAC addresses are printed only when you pinned one.
- Entrypoint arguments are kept. 1.x kept only the first one.
- A moved or deleted image no longer stops runlike. It prints a warning
on stderr and goes on. - Many more options: resource limits, health checks, security options,
namespaces, tmpfs, ulimits, sysctls and more. 1.x fully supported 17 of
the 103 options. - A Go library:
github.com/lavie/runlike/v2turnsdocker inspect
JSON into an argument list.
Fixed issues
- #141 Entrypoint arguments after the first are kept.
- #138 Anonymous volumes that the image declares are no longer printed.
- #134 Volume paths that contain spaces are quoted.
- #111 Command arguments that contain single quotes are quoted.
- #34 Named volumes are tested in the round-trip suite.
Docker CLI pin
What runlike prints follows the docker run reference and the behaviour of
Docker CLI and Engine v29.9.3. runlike also reads docker inspect output
from older daemons. Its tests use saved output from Docker 20.10, 24.0 and
26.1.
Thanks
Thanks to @dajiaohuang, @omyhub, @jeremymeyers and @wxl374 for reporting the
issues fixed here. Thanks to @BlocksecPHD (#139), @perkmi (#133) and
@PawanKumarA (#136) for pull requests about quoting paths with spaces and
supporting --cpus. 2.0 includes both. Thanks also to everyone who
contributed to runlike 1.x: its options and its bug reports shaped this
rewrite.
Upgrade notes
- The command line has not changed: the same options, arguments and exit
codes as 1.x. Scripts that call runlike keep working. - The output has changed. The flags use the long
--flag=valueform, and
defaults are left out. If a script compares or parses runlike's output,
check it. - Run the output with
eval "$(runlike NAME)". A bare$(runlike NAME)
splits quoted values. - The Python package is frozen at 1.6.3 on the
python-1.xbranch. PyPI
stays at 1.5.4.