See full command of running/stopped container in D

2019-01-20 23:25发布

How can I see the full command of a running container/process in Docker?

$ docker ps --all
CONTAINER ID    IMAGE          COMMAND                 CREATED          STATUS                     PORTS    NAMES
5b6291859b61    nginx:1.7.8    "nginx -g 'daemon of    4 minutes ago    Exited (0) 4 minutes ago            thirsty_brattain

I can only see "nginx -g 'daemon of".. here, not the full command.

标签: docker
4条回答
祖国的老花朵
2楼-- · 2019-01-20 23:46

Use:

docker inspect -f "{{.Name}} {{.Config.Cmd}}" $(docker ps -a -q)

... it does a "docker inspect" for all containers.

查看更多
爷、活的狠高调
3楼-- · 2019-01-20 23:54

Use runlike from git repository https://github.com/lavie/runlike

To install runlike

pip install runlike

As it accept container id as an argument so to extract container id use following command

docker ps -a -q

You are good to use runlike to extract complete docker run command with following command

runlike <docker container ID>
查看更多
相关推荐>>
4楼-- · 2019-01-21 00:05

docker ps -a --no-trunc will display the full command along with the other details of the running containers.

查看更多
We Are One
5楼-- · 2019-01-21 00:05

Use:

docker inspect -f "{{.Path}} {{.Args}} ({{.Id}})" $(docker ps -a -q)

That will display the command path and arguments, similar to docker ps.

查看更多
登录 后发表回答