How to show the run command of a docker container

前端 未结 11 1296
萌比男神i
萌比男神i 2020-11-27 10:24

I use a third party GUI (Synology Docker package) to setup a docker container. However, it\'s limitation makes me need to run the container from the command line. (I want to

11条回答
  •  天命终不由人
    2020-11-27 10:51

    Use docker inspect:

    $ docker inspect foo/bar
    [
        {
            # …
            "Config": {
                # …
                "Cmd": [
                    "/usr/local/bin/script.sh"
                ],
                # …
            }
        }
    ]
    

    You can programatically parse this with jq:

    $ docker inspect foo/bar | jq -r '.[0]["Config"]["Cmd"][0]'
    /usr/local/bin/script.sh
    

提交回复
热议问题