Is it possible to show the restart policy of a running Docker container?

前端 未结 4 2078
清歌不尽
清歌不尽 2021-02-04 23:50

When I create containers I\'m specifying a restart policy, but this is not shown in docker ps, and it doesn\'t appear any format string shows this either.

D

4条回答
  •  离开以前
    2021-02-05 00:19

    You can get this via docker inspect.

    Just the policy name:

    docker inspect --format '{{.HostConfig.RestartPolicy.Name}}' 
    

    Or the entire policy (including e.g. max retry count):

    docker inspect --format '{{json .HostConfig.RestartPolicy}}' 
    

提交回复
热议问题