I can’t get to azure container instance linked a file from my docker to a file that I placed in an azure storage account
the path after the volume name does not seem to be accepted : /conf/nginx.conf
volumes:
- nginxconf/conf/nginx.conf:/etc/nginx/nginx.conf
here is my docker-compose.yml
version: '3.9'
services:
client:
image: nginx
ports:
- '8080:80'
volumes:
- nginxconf/conf/nginx.conf:/etc/nginx/nginx.conf
volumes:
nginxconf:
driver: azure_file
driver_opts:
share_name: nginxfiles
storage_account_name: nginxcontainerstorage
storage_account_key: "xxxxxxxxxxxxxxx"
2
Answers
to solve my problem I modified the systemctl service file to launch nginx by specifying a configuration file in a different location. and I have a volume where there is the nginx.service and another with my nginx configuration. I mount folders and not a file and it works
my code : https://github.com/auriou/dockerfiles/tree/master/nginx
I had done the test locally and then on azure
Local :
azure: I copied the files to my azure storage
The systemd file for nginx
I have tried to reproduce the same in my environment and got the positive results.
Note: In this demo, I have tried to bind index.html file to /usr/share/nginx/html folder to identify the changes easily.
Step 1: Add docker context to run docker-compose.yaml in ACI
Refer to this link for more information on setting docker context.
To repro your issue, I have executed docker-compose.yaml file with below configuration as like yours.
I got the below error after running the above code.
Now, I have modified the above code as below.
Note: ACI does not support port mapping as of now. Container port and ACI port must be same.
Now run docker compose and verify the container instance created.
Compare the files in azure file share and ACI to check bind volume is working properly or not.
Below are the files in my Azure fileshare.
Below are the files in my Container.
Commands used in above screenshot.
Whatever changes or files adding in Azure file share, it will reflect same in container.