Skip to content

v2.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 06 Nov 18:48
· 17 commits to master since this release
0a5b8e3

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 run in 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 both docker inspect
    outputs.
  • Downloads: static binaries for Linux (amd64, arm64), macOS (Apple
    Silicon) and Windows (amd64, arm64), with SHA256SUMS. The Docker image
    assaflavie/runlike:2.0.0 is 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 with eval "$(runlike NAME)", not a bare $(runlike NAME).
  • New --shell powershell|cmd prints the command for PowerShell 7.3 or
    later, or for cmd.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's local log 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
    (-v or --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/v2 turns docker 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=value form, 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.x branch. PyPI
    stays at 1.5.4.