How does dockerfile define a variable profile?

for example, if there is a business program that has a Conf file with some configuration of the service ip, database address, how can it be specified when running the container? Or do you have to have a separate configuration file and then copy the new configuration file when you run the container?

I now know that one way to do this is to (take python as an example)
write a python script and run it in Dockerfile, so that the environment that needs to be mirrored supports python
. The main content is, Use os.environ to get the environment variable (assuming MYVAR)
, and then change the parameter in the configuration file to {var} plus double parentheses
and then such as osdict = os.environ
myvar = os.dict.get ("MYVAR", default)
with open (configuration file) as fp:

formatvar=myvar


this is generally placed in .env, but not in Dockerfile


https://github.com/laradock/l.


the configuration file must not be migrated to the image, the configuration file is still mounted or the environment variables are passed in or command line parameters are used. It is recommended that configmap in kubernetes is a reasonable way of configuration management.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e463d0-440df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e463d0-440df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?