Docker-compose not mounting unnamed volumes

Hello all,

For some reason my unnamed volumes do not appear under ./data/influxdb

This is my docker-compose.yml

  influxdb:
    env_file:
      - ./influxdb/influxdb.env
    image: influxdb:latest
    container_name: influxdb
    restart: always
    networks: [ metrics ]
    ports:
      - "8086:8086"
    volumes:
      - ./data/influxdb/data:/var/lib/influxdb2
      - ./data/influxdb/config:/etc/influxdb2

It does however work with

volumes:
  influxdata:
  influxconfig:
influxdb:
  env_file:
    - ./influxdb/influxdb.env
  image: influxdb:latest
  container_name: influxdb
  restart: always
  networks: [ metrics ]
  ports:
    - "8086:8086"
  volumes:
    - influxdata:/var/lib/influxdb2
    - influxconfig:/etc/influxdb2

although this is not what I want.

I’m not sure whether this is a docker or influxdb issue but since I can mount unnamed volumes in other containers I’m leaning towards it being an influxdb issue. But I’m not a docker expert…

Any help or clues are appreciated.

Do you have some error? What the ouput with docker-compose up without -d or docker container logs -f influxdb ?

By the way, this is my configuration (I don’t have the config volume):

version: "3.8"
services:
  influxdb:
    image: influxdb:2.1.1
    container_name: influxdb
    restart: unless-stopped
    ports:
      - "8086:8086"
    networks:
      - proxy
      - homeservices
    volumes:
      - ./data:/var/lib/influxdb2
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=proxy"
      - "traefik.http.routers.influxdb.entrypoints=websecure"
      - "traefik.http.routers.influxdb.service=influxdb"
      - "traefik.http.routers.influxdb.rule=Host(`influxdb.example.com`)"
      - "traefik.http.services.influxdb.loadbalancer.server.port=8086"

networks:
  proxy:
    external: true
  homeservices:
    name: homeservices
    driver: bridge

And it works.