Mark image as deprecated

Hi!

As a provider, I would like to inform that some of my Docker projects now are deprecated.

As other package managers, it would be by adding a new tag in Docker recipes and then, when pulling the image, Docker warns the user about the deprecation. For instance:

FROM anyimage:1.0.0

LABEL deprecated=TRUE # Or True, 1, ON, ...
$ docker build -t foobar/example:1.0.0
[+] Building 18.2s (6/8)
 => [internal] load build definition from Dockerfile
 => transferring dockerfile: 3.21kB                                                                                                                                                                                                     
[WARNING] foobar/example:1.0.0 is marked as deprecated.
[...]

$ docker install foobar/example:1.0.0
[WARNING] foobar/example:1.0.0 is marked as deprecated.

Or, adding a new image to be used:

FROM anyimage:1.0.0

LABEL deprecated=foobar/newexample/1.0.0
$ docker build -t foobar/example:1.0.0                                                                                                                                                                             
[WARNING] foobar/example:1.0.0 is marked as deprecated.
[...]

$ docker install foobar/example:1.0.0
[WARNING] foobar/example:1.0.0 is marked as deprecated. Install 'foobar/newexample/1.0.0' instead.
2 Likes