K
K
krll-k2016-11-24 15:14:31
Docker
krll-k, 2016-11-24 15:14:31

How to forward files to a running docker container?

I started the container

docker run -it -p 10000-10150:10000-10150/udp -p 5080:5080/udp voipnovatos/asterisk-13

But it's inconvenient to edit files inside the container, so I copied from there to here
docker cp sick_aryabhata:/etc/asterisk ./
Knowing that you can use the -v switch in conjunction with the run command , but :
How to transfer files to a running docker container?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
apterion7, 2016-11-29
@apterion7

I would do this:
Create volume
# docker volume create -d local --name asterisk-conf
Copy asterisk configs to created volume
# cp /etc/asterisk/* /var/lib/docker/asterisk-conf/_data/
Run container
# docker run -d -v asterisk-conf:/etc/asterisk -p 10000-10150:10000-10150/udp -p 5080:5080/udp voipnovatos/asterisk-13
Edit asterisk configs in /var/lib/docker/asterisk directory -conf/_data/ (you can make symlinks for convenience), apply the configuration, for example, like this:
# docker exec -it "conteiner id" asterisk -rx "dialplan reload"
or like this:
# docker exec -it "conteiner id" /bin /bash
and in the shell you can already restart asterisk, look at asterisk -rvvv, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question