Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set docker container labels based on output of previous run command during build?

I wonder if is possible to set a LABEL during building of a container with a based that is based on a command run on the container.

Example, wanting to expose python=2.7.14 when the number would be obtained from running python --version during build.

The idea is to expose some information about what was build as labels, before starting the build these versions are not known (like packages installed using yum).

like image 726
sorin Avatar asked Dec 05 '25 03:12

sorin


1 Answers

Seems like it is just not possible. You need to use build arguments before launching the build.

like image 60
William Desportes Avatar answered Dec 08 '25 08:12

William Desportes



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!