Get docker run command for container -


i have container created, can't remember exact docker run command used kick off. there way can retrieved?

this not same see full command of running/stopped container in docker want know full docker command spawned container, not command within container.

you can infer of information looking @ output of docker inspect.

for example, can discover command started inside container looking @ config.cmd key. if run:

$ docker run -v /tmp/data:/data --name sleep -it --rm alpine sleep 600 

i can later run:

$ docker inspect --format '{{.config.cmd}}' sleep  

and get:

{[sleep 600]} 

similarly, output of docker inspect include information docker volumes used in container:

$ docker inspect --format '{{.volumes}}' sleep map[/data:/tmp/data] 

you can of course run docker inspect without --format, give big (100+ lines) chunk of json output containing available keys, includes information port mappings, network configuration, , more.


Comments