title: Deploy labels in docker compose not supported by AWS ECS
body: <p>I'm trying to deploy a (simple) app stack consisting of a front-end, back-end, database and Traefik reverse proxy into AWS ECS. Everything put together in a Docker compose file.</p>
  <p>I followed the docs at <a href="https://docs.docker.com/cloud/ecs-integration/" rel="nofollow noreferrer">https://docs.docker.com/cloud/ecs-integration/</a> and looked up carefully the supported features here: <a href="https://docs.docker.com/cloud/ecs-compose-features/" rel="nofollow noreferrer">https://docs.docker.com/cloud/ecs-compose-features/</a>.</p>
  <p>Everything runs smoothly locally, incl. the Traefik configuration using labels. However, Traefik does not recognise any services in ECS (despite running with the proper role as described in <a href="https://doc.traefik.io/traefik/providers/ecs/" rel="nofollow noreferrer">https://doc.traefik.io/traefik/providers/ecs/</a>). I think it is because <strong>labels</strong> are not defined in the ECS tasks, although they should be supported. When I run <code>docker compose up</code> in the ECS context, I get</p>
  <pre><code>WARNING services.deploy.labels: unsupported attribute
  </code></pre>
  <p>Here is the compose file (a bit shorten):</p>
  <pre><code>version: &quot;3&quot;
  
  services:
    proxy:
      image: traefik:v2.5
      networks:
        - ${TRAEFIK_PUBLIC_NETWORK?Variable not set}
        - default
      ports:
        - &quot;8080:8080&quot;
        - &quot;80:80&quot;
      command:
        - --providers.ecs=true
        - --providers.ecs.clusters=mycluster
        - --providers.ecs.constraints=Label(`traefik.constraint-label-stack`, `${TRAEFIK_TAG?Variable not set}`)
        - --providers.ecs.exposedbydefault=false
        - --accesslog
        - --log
        - --log.level=DEBUG
        - --api
      x-aws-role:
        Version: &quot;2012-10-17&quot;
        Statement:
          Effect: &quot;Allow&quot;
          Action:
            - &quot;ecs:ListClusters&quot;
            - &quot;ecs:DescribeClusters&quot;
            - &quot;ecs:ListTasks&quot;
            - &quot;ecs:DescribeTasks&quot;
            - &quot;ecs:DescribeContainerInstances&quot;
            - &quot;ecs:DescribeTaskDefinition&quot;
            - &quot;ec2:DescribeInstances&quot;
          Resource:
            - &quot;*&quot;
      deploy:
        labels:
          - traefik.enable=true
          - traefik.docker.network=${TRAEFIK_PUBLIC_NETWORK?Variable not set}
          - traefik.constraint-label=${TRAEFIK_PUBLIC_TAG?Variable not set}
          - traefik.http.middlewares.${STACK_NAME?Variable not set}-https-redirect.redirectscheme.scheme=https
          - traefik.http.middlewares.${STACK_NAME?Variable not set}-https-redirect.redirectscheme.permanent=true
          - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.rule=Host(`${DOMAIN?Variable not set}`) || Host(`www.${DOMAIN?Variable not set}`)
          - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.entrypoints=http
          - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.rule=Host(`${DOMAIN?Variable not set}`) || Host(`www.${DOMAIN?Variable not set}`)
          - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.entrypoints=https
          - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.tls=true
          - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.tls.certresolver=le
          - traefik.http.services.${STACK_NAME?Variable not set}-proxy.loadbalancer.server.port=80
          - traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.regex=^https?://(www.)?(${DOMAIN?Variable not set})/(.*)
          - traefik.http.middlewares.${STACK_NAME?Variable not set}-www-redirect.redirectregex.replacement=https://${DOMAIN?Variable not set}/$${3}
          - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-https.middlewares=${STACK_NAME?Variable not set}-www-redirect
          - traefik.http.routers.${STACK_NAME?Variable not set}-proxy-http.middlewares=${STACK_NAME?Variable not set}-www-redirect,${STACK_NAME?Variable not set}-https-redirect
  
    db:
      image: postgres:13
      env_file:
        - .env.local
      environment:
        - PGDATA=/var/lib/postgresql/data/pgdata
      ports:
        - &quot;${POSTGRES_PORT-5432}:5432&quot;
      deploy:
        resources:
          limits:
            cpus: '0.5'
            memory: 1024M
  
    backend:
      image: '${DOCKER_IMAGE_BACKEND?Variable not set}:${TAG-latest}'
      depends_on:
        - db
      env_file:
        - .env.local
      environment:
        - SERVER_NAME=${DOMAIN?Variable not set}
        - SERVER_HOST=https://${DOMAIN?Variable not set}
      build:
        context: ./
        dockerfile: backend.dockerfile
        args:
          INSTALL_DEV: ${INSTALL_DEV-&quot;false&quot;}
      ports:
        - &quot;${BACKEND_PORT-8000}:8000&quot;
      deploy:
        resources:
          limits:
            cpus: '0.5'
            memory: 1024M
        labels:
          - traefik.enable=true
          - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
          - traefik.http.routers.${STACK_NAME?Variable not set}-backend-http.rule=PathPrefix(`/api`) || PathPrefix(`/docs`) || PathPrefix(`/redoc`)
          - traefik.http.services.${STACK_NAME?Variable not set}-backend.loadbalancer.server.port=8000
  
    frontend:
      image: '${DOCKER_IMAGE_FRONTEND?Variable not set}:${TAG-latest}'
      env_file:
        - .env.local
      build:
        context: ./
        dockerfile: frontend.dockerfile
        args:
          FRONTEND_ENV: ${FRONTEND_ENV-production}
      ports:
        - &quot;${FRONTEND_PORT-3000}:3000&quot;
      deploy:
        resources:
          limits:
            cpus: '0.5'
            memory: 1024M
        labels:
          - traefik.enable=true
          - traefik.constraint-label-stack=${TRAEFIK_TAG?Variable not set}
          - traefik.http.routers.${STACK_NAME?Variable not set}-frontend-http.rule=PathPrefix(`/`)
          - traefik.http.services.${STACK_NAME?Variable not set}-frontend.loadbalancer.server.port=3000
  
  
  networks:
    traefik-public:
      external: ${TRAEFIK_PUBLIC_NETWORK_IS_EXTERNAL-true}
      name: &quot;sg-mycluster&quot;
  </code></pre>
  <p>Any hints much appreciated!</p>
  <p>Thanks!
  Jakub</p>