How to NOT inherit labels from base images in Docker?

Viewed 1663

When a docker image X is used as the base image for docker image Y, image Y inherits all of X's labels. That is, image Y has all the labels of X plus any labels Y adds.

Is there any way to prevent this label inheritance from happening, either in the Dockerfile or in the docker build command?

1 Answers

I don't think there is a way to remove labels. I'm using my own 'namespace' when I add labels in my image so that I can find the ones I want easily later. Example label can be com.mycompanyname.foo set to value bar.

Related