D
D
Dim Boy2018-04-07 14:47:57
Virtualization
Dim Boy, 2018-04-07 14:47:57

How to go into the Docker volume and change the settings?

Tell me how can I go into that, change the configuration file there and save it?
Specifically, you need Mailcow , you need to go to mail_postfix-vol-1 .

Answer the question

In order to leave comments, you need to log in

3 answer(s)
T
Twelfth Doctor, 2018-04-07
@verdex

Perhaps you should find out which container is using this volume and run docker exec -it CONTAINER_NAME /bin/bash
You will be taken to the container console and can edit the files that are in the volume.

S
shurshur, 2018-04-07
@shurshur

1. With the help of exec, get inside the container (but there may not be a suitable editor there, and sed / awk may not be enough.
2. Create a new temporary container into which to connect this one as volume, and edit, for example
docker run -it --rm -v mail_postfix-vol-1:/xxx debian Inside
you can do apt update && apt install vim, the container is still temporary and will be deleted on exit.
editing will not be a problem.

A
Alexander, 2018-04-08
@sah4ez32

You can do something like this in docker. Enter the container via docker exec -it CONTAINER_NAME /bin/bash, then change the desired file and do docker commit (like this) which will make a new image and it will be stored on your host.
BUT! It is not right.
If you have your own development, then it is more correct to transfer the parameters through ENV.
And in your case, the best thing would be docker cp CONTAINER_NAME:/path/to/file /local/path/to/file
Then edit it to your heart's content. And then mount it in the container at startup to the place where it should be. This option turns out to be moderately flexible (although putting configs into a container is evil). If you go further (k8s and others), then the problems will only increase. For acquaintance I advise to read "12 factors".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question