Sign inSign up

nexdrew/rekcod

By nexdrew

Updated about 6 years ago

docker inspect → docker run

Image
8

50K+

nexdrew/rekcod repository overview

rekcod

Reverse engineer a docker run command from an existing container (via docker inspect).

rekcod can turn any of the following into a docker run command:

  1. container ids/names (rekcod will call docker inspect)
  2. path to file containing docker inspect output
  3. raw JSON (pass the docker inspect output directly)

Each docker run command can be used to duplicate the containers.

Usage

Quick run:

$ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nexdrew/rekcod <container>

Pull and define alias:

$ docker pull nexdrew/rekcod
$ alias rekcod="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nexdrew/rekcod"

Pass one or more container names or ids and rekcod will print to stdout a docker run command that duplicates those containers.

Fields Supported

rekcod will translate the following docker inspect fields into the listed docker run arguments.

docker inspectdocker run
Name--name
HostConfig.Privileged--privileged
HostConfig.Runtime--runtime
HostConfig.Binds-v
HostConfig.VolumesFrom--volumes-from
HostConfig.PortBindings-p
HostConfig.Links--link
HostConfig.PublishAllPorts-P
HostConfig.NetworkMode--net
HostConfig.UTSMode--uts
HostConfig.RestartPolicy--restart
HostConfig.ExtraHosts--add-host
HostConfig.GroupAdd--group-add
HostConfig.PidMode--pid
HostConfig.SecurityOpt--security-opt
Config.Hostname-h
Config.Domainname--domainname
Config.ExposedPorts--expose
Config.Labels-l
Config.Env-e
Config.Attach* !== true-d
Config.AttachStdin-a stdin
Config.AttachStdout-a stdout
Config.AttachStderr-a stderr
Config.Tty-t
Config.OpenStdin-i
Config.Entrypoint--entrypoint
Config.Image || Imageimage name or id
Config.Cmdcommand and args

GitHub

Get more info here: https://github.com/nexdrew/rekcod

Tag summary

Content type

Image

Digest

Size

78.5 MB

Last updated

over 6 years ago

docker pull nexdrew/rekcod