K
K
krll-k2017-04-23 15:31:10
freepbx
krll-k, 2017-04-23 15:31:10

How do I save my changes in the Docker image I took for later reuse?

I take the image https://hub.docker.com/r/lluisyast/freepbx/, deploy, configure, everything works, I'm happy. How to save your settings now? Are there any good practices please?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2017-04-25
@krll-k

Despite the ability to do docker commit, what you get as a result will be a black box that is not clear how it was created. Good practice here is to describe any changes you make to the container with Dockerfile-a. This Dockerfileone can be stored in the version control system, reviewed, modified, reproduced in the assembly line.
Yes, under the hood, every line in Dockerfile-e is called docker commit, but the important thing is that in this case, the source of these changes is preserved.
I don't know how FreePBX is configured exactly, but you may need to use, for exampleenvsubstto apply the environment variables that the container is running with to configuration files. Or you may need to make a start .sh script that will perform the necessary
configuration actions at startup.
In the case of using environment variables, it is also very useful in the startup script to check if they are set, and if not, fail with a meaningful error message:

echo MY_ENV_VAR "${MY_ENV_VAR?MY_ENV_VAR is required!}"

K
krll-k, 2017-04-23
@krll-k

The 'docker commit' command takes the top layer of the container, the one for writing, and turns it into a layer for reading. This effectively turns the container (whether or not it is running) into an immutable image.
https://habrahabr.ru/post/272145/ - a theory about how Docker works

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question