Docker Community Forums

Share and learn in the Docker community.

Setting container labels with the remote api


(Marius Gundersen) #1

According to the docker api documentation (specifically the change notes for v1.17) it is possible to set the labels on a container when using /containers/create, but I cannot find any examples or details on how to achieve this. How should the JSON used to create a container look if I want to set labels on it?


(Donald Huang) #2

have you looked at the full API docs? the example request includes labels


(Marius Gundersen) #3

I found out that every label value had to be a key, so the json cannot have a label set to true or a number, it will be silently ignored. I’m fact, all labels will be silently removed!