seems the directly answer is NO
(the ARG/ENV just workaroud)
And I trying to understand why, by compare it to ARG/ENV.
- ARG/ENV store infomation in storage layer
ARG
is build-time const
//runtime can't access in container, but user can inspect image see it
ENV
is build-time & runtime const
- image
tag
is different
- has nothing on storage layer
- can't direct access in container
- some kind of meta data for image (on host)
- can be change at build-time or run-time (one image, multi tag, or no tag)
//not in the same dimension with container
//but the tag name passed to docker build
should special (like ARG/ENV)?
at last, I guess it's by design, they want
- keep tag only in host context (and mark image at anytime)
- only for image select (not affect container in other way)
BTW, try to understand env and arg (maybe off-topic)
(maybe not entirely accurate)
|
build-time |
build-time |
runtime |
runtime |
image |
container |
|
set |
get |
set |
get |
inspect |
inspect |
ENV |
dockerfile |
env |
cmdline |
env |
in config |
in config |
ARG |
dockerfile cmdline |
env |
NA |
NA |
in layer |
NA |
tag |
cmdline |
NA |
cmdline |
NA |
in meta |
in config |