D
D
DenZel2020-01-29 17:46:22
linux
DenZel, 2020-01-29 17:46:22

How to run a docker container with values ​​in files?

Hello!
The following need arose to automate the launch of the container with its files:
- there is a configuration file in which for each launch of the container it is necessary to enter new parameter values
​​- tell me how to make it so that when the container (or building the image) is started and the desired value is specified, this value is entered into the file and this file was then used to create/start the container.
For example: there is Zabbix-agentd.conf in which each host has its own hostname. So, when starting the container, specify the hostname that will be written to the config and then this configuration is copied to the container to start the Zabbix-agent service.
Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
chupasaurus, 2020-01-29
@gen4_gdm

There are 2 equal solutions:

  • Throw configs on hosts and connect them through volumes
  • Edit the template config with a script in the entrypoint of the image through the environment variables set when creating the container.

In essence, the choice is between serving individual configs on hosts or a script in an image.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question