I have a dockerized php application. I want to set the version and the buildTime as a env variable from a file called version
VERSION=$(head -n 1 version)
buildTime=$(head -2 version | tail -1)
The problem that it consider the dash in -n
and -1
as a special characters.
How can I solve this problem?
2
Answers
I’m going to imagine you have a file called
version
which ONLY contain the version of your systemWhy just don’t
If for some reason you have other information in this file, you can just use
sed
.Make use of –env-file option of docker run command.
version.env
file containing the required detailsHope this helps.