I use a docker-image of an asterisk dougbtv / asterisk14. I send the configuration files to the container using the -v option (-v ... / sip.conf: /etc/asterisk/sip.conf) After changing the file on the host, in the container asterisk I try to re-read these settings, but the changes are not applied. In this regard, the question is: when creating a docker image, when forwarding files, is a copy of them created, or is the same file used? And if the first is how to make changes available to the container without restarting it entirely?

UPD: Container launch:

docker run --name=asterisk --net=host --restart=always -v /usr/share/restcomm/asterisk/sip.conf:/etc/asterisk/sip.conf -v /usr/share/restcomm/asterisk/extensions.ael:/etc/asterisk/extensions.ael -d -t dougbtv/asterisk14 

Docker inspect output

 [ { "Id": "50ff2917df273d3ea62df41bc35fe45daeeee41a12c770420c8bd3c122354e13", "Created": "2017-03-08T16:43:26.811690072Z", "Path": "/bin/sh", "Args": [ "-c", "asterisk -f" ], "State": { "Status": "running", "Running": true, "Paused": false, "Restarting": false, "OOMKilled": false, "Dead": false, "Pid": 18277, "ExitCode": 0, "Error": "", "StartedAt": "2017-03-08T16:43:27.145290714Z", "FinishedAt": "0001-01-01T00:00:00Z" }, "Image": "sha256:896bf5cfc5a6b9d078d31a30e588918a064d814ea7a02a6bb9cb45b07b827298", "ResolvConfPath": "/var/lib/docker/containers/50ff2917df273d3ea62df41bc35fe45daeeee41a12c770420c8bd3c122354e13/resolv.conf", "HostnamePath": "/var/lib/docker/containers/50ff2917df273d3ea62df41bc35fe45daeeee41a12c770420c8bd3c122354e13/hostname", "HostsPath": "/var/lib/docker/containers/50ff2917df273d3ea62df41bc35fe45daeeee41a12c770420c8bd3c122354e13/hosts", "LogPath": "", "Name": "/asterisk", "RestartCount": 0, "Driver": "devicemapper", "MountLabel": "", "ProcessLabel": "", "AppArmorProfile": "", "ExecIDs": null, "HostConfig": { "Binds": [ "/usr/share/restcomm/asterisk/sip.conf:/etc/asterisk/sip.conf", "/usr/share/restcomm/asterisk/extensions.ael:/etc/asterisk/extensions.ael" ], "ContainerIDFile": "", "LogConfig": { "Type": "journald", "Config": {} }, "NetworkMode": "host", "PortBindings": {}, "RestartPolicy": { "Name": "always", "MaximumRetryCount": 0 }, "AutoRemove": false, "VolumeDriver": "", "VolumesFrom": null, "CapAdd": null, "CapDrop": null, "Dns": [], "DnsOptions": [], "DnsSearch": [], "ExtraHosts": null, "GroupAdd": null, "IpcMode": "", "Cgroup": "", "Links": null, "OomScoreAdj": 0, "PidMode": "", "Privileged": false, "PublishAllPorts": false, "ReadonlyRootfs": false, "SecurityOpt": null, "UTSMode": "", "UsernsMode": "", "ShmSize": 67108864, "Runtime": "docker-runc", "ConsoleSize": [ 0, 0 ], "Isolation": "", "CpuShares": 0, "Memory": 0, "CgroupParent": "", "BlkioWeight": 0, "BlkioWeightDevice": null, "BlkioDeviceReadBps": null, "BlkioDeviceWriteBps": null, "BlkioDeviceReadIOps": null, "BlkioDeviceWriteIOps": null, "CpuPeriod": 0, "CpuQuota": 0, "CpusetCpus": "", "CpusetMems": "", "Devices": [], "DiskQuota": 0, "KernelMemory": 0, "MemoryReservation": 0, "MemorySwap": 0, "MemorySwappiness": -1, "OomKillDisable": false, "PidsLimit": 0, "Ulimits": null, "CpuCount": 0, "CpuPercent": 0, "IOMaximumIOps": 0, "IOMaximumBandwidth": 0 }, "GraphDriver": { "Name": "devicemapper", "Data": { "DeviceId": "15", "DeviceName": "docker-253:0-13858-d8bf701e1bcdfb8ea373ec4d64c32cdf0467ed84b3ae58cf25a76cab02ee6449", "DeviceSize": "10737418240" } }, "Mounts": [ { "Source": "/usr/share/restcomm/asterisk/sip.conf", "Destination": "/etc/asterisk/sip.conf", "Mode": "", "RW": true, "Propagation": "rprivate" }, { "Source": "/usr/share/restcomm/asterisk/extensions.ael", "Destination": "/etc/asterisk/extensions.ael", "Mode": "", "RW": true, "Propagation": "rprivate" } ], "Config": { "Hostname": "<...>", "Domainname": "", "User": "", "AttachStdin": false, "AttachStdout": false, "AttachStderr": false, "Tty": true, "OpenStdin": false, "StdinOnce": false, "Env": [ "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "build_date=2017-03-01" ], "Cmd": [ "/bin/sh", "-c", "asterisk -f" ], "Image": "dougbtv/asterisk14", "Volumes": null, "WorkingDir": "/", "Entrypoint": null, "OnBuild": null, "Labels": { "build-date": "20161214", "license": "GPLv2", "name": "CentOS Base Image", "vendor": "CentOS" } }, "NetworkSettings": { "Bridge": "", "SandboxID": "83d7947e4ed2e34cbaa3774801ce10293d70f478b8393cdac0d571f7ba4fa0e5", "HairpinMode": false, "LinkLocalIPv6Address": "", "LinkLocalIPv6PrefixLen": 0, "Ports": {}, "SandboxKey": "/var/run/docker/netns/default", "SecondaryIPAddresses": null, "SecondaryIPv6Addresses": null, "EndpointID": "", "Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "MacAddress": "", "Networks": { "host": { "IPAMConfig": null, "Links": null, "Aliases": null, "NetworkID": "1cb1bae1b3959d439cdcc7938f2cefe664ea1e8e640b0ae40b4a7be0f03f9d39", "EndpointID": "3557af97cd0b828bd06c33444bc27ca858f0e780d5e6d4124d24b34621d2c660", "Gateway": "", "IPAddress": "", "IPPrefixLen": 0, "IPv6Gateway": "", "GlobalIPv6Address": "", "GlobalIPv6PrefixLen": 0, "MacAddress": "" } } } } ] 

Editing sip.conf and extensions.ael using vim from the container and from the host leads to a change in only one version.

  • The same file is used, the easiest way is to present it as a symlink. Apparently, either you did not restart the daemon, or it works in the same way with new settings. - etki
  • @etki Changed sip.conf inside the container, there are no changes on the host. Chyadt? - carapuz
  • Can you attach the docker inspect <container name/id> output, the full launch command and how you edit the file? - etki

0