Mounting volume in Azure-Container-Service not working for traefik.toml and /var/run/docker.sock

泪湿孤枕 提交于 2019-12-24 00:44:11

问题


Building an CI/CD pipeline from VSTS to Azure-container-service I've ran into an issue mounting the traefik.toml and the docker.sock file.

The deployment uses an SSH tunnel to create a folder /Deploy/ and copy the docker-compose.yml and traefik.toml. The files are there, the containers are spun up. Yet not handled by traefik, because it does not 'see' the containers.

The traefik tutorial shows we can mount the like so in a docker-compose.yml:

version: '2' 

services:
  proxy:
    build: 
      context: .
      dockerfile: /Traefik/dockerfile
    restart: always
    command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
    networks:
      - internal
    ports:
      - "80:80"
      - "8080:8080"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /dev/null:/traefik.toml

This runs perfectly fine on my windows 10 machine, running docker 17.09.0-ce But when deployed to Azure-Container-Service I receive the following error:

ERROR: Named volume "\var\run\docker.sock:/var/run/docker.sock:rw" is used in service "proxy" but no declaration was found in the volumes section.

https://github.com/docker/compose/issues/3073 opts for an extra dot (.) to signal it's a mapping to the host volume. Tried it, no error but it does not actually mount.

 "Mounts": [
            {
                "Type": "bind",
                "Source": "/home/dutchitworks/deploy/.\\var\\run\\docker.sock",
                "Destination": "/var/run/docker.sock",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            },
            {
                "Type": "bind",
                "Source": "/home/dutchitworks/deploy/.\\dev\\null",
                "Destination": "/traefik.toml",
                "Mode": "rw",
                "RW": true,
                "Propagation": "rprivate"
            }
        ],

it adds the /home/dutchitworks/deploy/. from somewhere...

Any ideas how the get the traefik.toml mapped correctly would be welcome...

来源:https://stackoverflow.com/questions/47463640/mounting-volume-in-azure-container-service-not-working-for-traefik-toml-and-var

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!