How can I get a Docker image's label if the label name has a “.” in it?

后端 未结 1 1844
情歌与酒
情歌与酒 2021-01-01 12:00

The docker inspect command can be very useful for getting the labels on a Docker image:

# -*- Dockerfile -*-
FROM busybox
LABEL foo=\"bar\"
LABEL com.whereve         


        
1条回答
  •  孤城傲影
    2021-01-01 12:37

    The index function is what I was looking for. It can lookup arbitrary strings in the map.

    $ docker inspect -f '{{ index .Config.Labels "com.wherever.foo" }}' foo
    bang
    

    0 讨论(0)
提交回复
热议问题