I have a container on Azure. When the container starts, it will run a script to modify some configuration files under /var/lib/myservice/conf/
. I also want to mount an Azure Files volume in this container with volume mount path is /var/lib/myservice/
. The problem is that the container cannot run successfully. If I change the volume path to /var/lib/myservice/logs/
it will start successfully. I think the problem is because when mouting, my script cannot find the configuration files so it cannot modify it. Folder /logs
is intact so the container starts successfully.
I'm sorry if my question maybe a bit confusing. Any one can help me how to mouting directory /var/lib/myservice/
successfully ? Thank you very much.
Asked
Active
Viewed 51 times
0

ktcl
- 365
- 6
- 23
1 Answers
0
The problem is that if you mount the Azure Files volumes to the path /var/lib/myservice/
, then the volume will overwrite the path and leave it empty as the Azure files. But the files in that path are necessary for your service initial. So the container cannot run successfully.
The logs are not necessary for your service initial, so it does not affect your service when you mount to the path of the log.

Charles Xu
- 29,862
- 2
- 22
- 39
-
So there is no way to mount directory /var/lib/myservice/ ? – ktcl Aug 15 '19 at 09:29
-
@KhuynhThànhChiLuyến You can also mount, but you need to upload the necessary files of your service to the Azure files first, then mount it. – Charles Xu Aug 15 '19 at 09:30
-
I'm just wondering because it works fine when I deploy on-premise with docker. Thank you very much. – ktcl Aug 15 '19 at 09:36
-
@KhuynhThànhChiLuyến Yes, it's a little different from docker locally. Actually, It's a sequence problem. As I know, docker will use the volumes instead of the path in the container, then the container starts and initials the application in it. But ACI, it creates container instance and initials the application, then it mounts the Azure files to container to persist the data. So it makes the difference. – Charles Xu Aug 15 '19 at 09:41
-
Thank you very much, I have no more question about this. – ktcl Aug 16 '19 at 07:46