Using Azure Web Apps for Containers to spin up a docker-compose configuration. The primary proxy is Traefik which needs access to the docker API. The container start up correctly. But the traefik container can not access the docker API socket file.
The docker-compose settings for the volume of the traefik container is:
services:
traefik:
image: "traefik:v2.0"
[...]
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
[...]
The containers start up successfully with the following log:
2019-09-16 10:40:35.040 INFO - Pulling image from Docker hub: library/traefik:v2.0 2019-09-16 10:40:35.589 INFO - v2.0 Pulling from library/traefik 2019-09-16 10:40:35.810 INFO - Digest: sha256:97c6da99b265de1c50e866ff66f927abb84659dcb7916c33e17623fc6969551c 2019-09-16 10:40:35.816 INFO - Status: Image is up to date for traefik:v2.0 2019-09-16 10:40:35.835 INFO - Pull Image successful, Time taken: 0 Minutes and 0 Seconds 2019-09-16 10:40:35.871 INFO - Starting container for site 2019-09-16 10:40:35.872 INFO - docker run -d -p 40317:80 --name containertest3_traefik_1_6d1c6629 -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=containertest3 -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=containertest3.azurewebsites.net -e WEBSITE_INSTANCE_ID=902eae0c51eb407ec9308de2a1c3fce2b35f53f6d148e328560acba2560930f0 -e HTTP_LOGGING_ENABLED=1 traefik:v2.0 --api.insecure=true --providers.docker=true --providers.docker.exposedbydefault=false --entrypoints.web.address=:80 --entryPoints.web.forwardedHeaders.insecure
2019-09-16 10:40:36.215 INFO - Pulling image from Docker hub: containous/whoami 2019-09-16 10:40:36.779 INFO - latest Pulling from containous/whoami 2019-09-16 10:40:36.780 INFO - Digest: sha256:09229ae40edb92e95b15e90fef46bfadab14fd1ec2232aca717a501741fcf391 2019-09-16 10:40:36.788 INFO - Status: Image is up to date for containous/whoami:latest 2019-09-16 10:40:36.790 INFO - Pull Image successful, Time taken: 0 Minutes and 0 Seconds 2019-09-16 10:40:36.815 INFO - Starting container for site 2019-09-16 10:40:36.816 INFO - docker run -d -p 0:80 --name containertest3_whoami_1_6d1c6629 -e WEBSITES_ENABLE_APP_SERVICE_STORAGE=false -e WEBSITE_SITE_NAME=containertest3 -e WEBSITE_AUTH_ENABLED=False -e WEBSITE_ROLE_INSTANCE_ID=0 -e WEBSITE_HOSTNAME=containertest3.azurewebsites.net -e WEBSITE_INSTANCE_ID=902eae0c51eb407ec9308de2a1c3fce2b35f53f6d148e328560acba2560930f0 -e HTTP_LOGGING_ENABLED=1 containous/whoami
2019-09-16 10:40:47.048 INFO - Started multi-container app 2019-09-16 10:40:47.099 INFO - Initiating warmup request to container containertest3_traefik_1_6d1c6629 for site containertest3 2019-09-16 10:40:47.101 INFO - Container containertest3_traefik_1_6d1c6629 for site containertest3 initialized successfully and is ready to serve requests.
However, in the error logs, Traefik can not acces the docker api and therefore does not work correctly:
2019-09-16T10:40:47.505909459Z time="2019-09-16T10:40:47Z" level=error msg="Provider connection error Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?, retrying in 1.080381816s" providerName=docker
2019-09-16T10:40:48.585335458Z time="2019-09-16T10:40:48Z" level=error msg="Failed to retrieve information of the docker client and server host: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
Final error for the Traefik container: "Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?"
Any idea how to fix this error in the Azure app environment? Is this not possible within the Azure hosting/preview for App containers?
The Azure Web App service does not allow for reading from docker.sock. You need to use another configuration provider in traefik if you want to run multi-container in Azure App Service.