# Simple example with configuration files (static and dynamic)

**URL:** <https://community.traefik.io/t/simple-example-with-configuration-files-static-and-dynamic/26981>\
**Category:** Traefik v3 (latest)\
**Tags:** dashboard-api, docker\
**Created:** [March 25, 2025, 12:02am UTC](https://community.traefik.io/t/simple-example-with-configuration-files-static-and-dynamic/26981 "2025-03-25T00:02:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexisauch01](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Alexisauch01](https://community.traefik.io/u/Alexisauch01)\
**Post date:** [March 25, 2025, 12:02am UTC](https://community.traefik.io/t/simple-example-with-configuration-files-static-and-dynamic/26981/1 "2025-03-25T00:02:40Z")

</div>

Hello everyone,  
I want to have my static and dynamic configurations in separate files (I was able to make it work using docker-compose.yml only with commands (static) and labels (dynamic))  
I'm starting form scratch with a basic example: traefik dashboard over https with letsencrypt certificates, but I'm not able to get it done.

Here are my files:

**Docker-compose.yml**

```auto
# @prettier
version: "3.3"
networks:
  proxy:
    name: proxy
    external: true
volumes:
  letsencrypt:
    name: letsencrypt
services:
  traefik:
    image: traefik:v3.2
    networks:
      - proxy
    command:
      - --configfile=/etc/traefik/traefik.yml
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./letsencrypt:/letsencrypt
      - ./config:/etc/traefik/config
      - ./logs:/var/log
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    restart: unless-stopped

```

**traefik.yml** (static)

```auto
## STATIC CONFIGURATION
################################################################
# Traefik Logging
################################################################
log:
  level: INFO
  format: common
  filepath: /var/log/traefik.log
accesslog:
  filepath: /var/log/traefik-access.log
################################################################
# API and dashboard configuration
################################################################
api:
  insecure: true
  dashboard: true
################################################################
# Docker configuration backend
################################################################
providers:
  docker:
    watch: true
    exposedByDefault: false
    endpoint: unix:///var/run/docker.sock
    network: proxy
  file:
    directory: /etc/traefik/config
    watch: true
accesslog: 
  filepath: /var/log/traefik.log
################################################################
# Entrypoint
################################################################
entryPoints:
  web:
    address: :80
    http:
      redirection:
        entrypoint:
          to: websecure
          scheme: https
  websecure:
    address: :443
################################################################
# Challenge TLS
################################################################
certresolver:
  letsencrypt:
    acme:
      tlschallenge:
        email: admin@mydomain.com
        storage: /letsencrypt/acme.json

```

**dynamic.yml**

```auto
http: 
  routers:
    dashboard:
      rule: Host(`traefik.mydomain.com`) || Host(`www.traefik.mydomain.com`)
      middlewares: authtraefik
      service: dashboard
      entrypoints : websecure
      tls:
        certresolver: letsencrypt
  middlewares:
    authtraefik:
      basicauth:
        users : **mycredentialshashed**

```

Folder hierarchy:  
./traefik.yml  
./config/dynamic.yml

My logs are empty (ie ./logs is empty) and docker logs container-id gives nothing.

Can someone tell me what am I doing wrong ?

Thank you

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [March 25, 2025, 5:37am UTC](https://community.traefik.io/t/simple-example-with-configuration-files-static-and-dynamic/26981/2 "2025-03-25T05:37:29Z")

</div>

> [@Alexisauch01](#):
>
> ```auto
> command:
> - --configfile=/etc/traefik/traefik.yml
> volumes:
> - /var/run/docker.sock:/var/run/docker.sock
> - ./letsencrypt:/letsencrypt
> - ./config:/etc/traefik/config
> - ./logs:/var/log
> 
> ```

Did you place the `traefik.yml` file inside the container?

---

<div class="post-metadata">

**Author:** ![Alexisauch01](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@Alexisauch01](https://community.traefik.io/u/Alexisauch01)\
**Post date:** [March 26, 2025, 1:55am UTC](https://community.traefik.io/t/simple-example-with-configuration-files-static-and-dynamic/26981/3 "2025-03-26T01:55:00Z")

</div>

Indeed, I have mounted the file and it works now. Thank you so much
