boilerplates icon indicating copy to clipboard operation
boilerplates copied to clipboard

traefik.yaml: is a directory

Open DW4y opened this issue 1 year ago • 9 comments

Hi,

I used your template and Youtube and running in this issue:

2024/02/17 12:10:38 command traefik error: read /etc/traefik/traefik.yaml: is a directory

Docker-Compose:

---
networks:
  frontend:
    external: true
  backend:
    external: true
services:
  traefik:
    image: traefik:latest
    container_name: traefik
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    volumes:
      - ./config:/etc/traefik/
      - /var/run/docker.sock:/var/run/docker.sock:ro
      - /etc/localtime:/etc/localtime:ro
    environment:
      - NJALLA_TOKEN=XYZ
    networks:
      - frontend
      - backend
    restart: unless-stopped

traefik.yaml:

global:
  checkNewVersion: true
  sendAnonymousUsage: false

# -- (Optional) Change Log Level and Format here...
#     - loglevels [DEBUG, INFO, WARNING, ERROR, CRITICAL]
#     - format [common, json, logfmt]
# log:
#  level: ERROR
#  format: common
#  filePath: /var/log/traefik/traefik.log

# -- (Optional) Enable Accesslog and change Format here...
#     - format [common, json, logfmt]
# accesslog:
#   format: common
#   filePath: /var/log/traefik/access.log

# -- (Optional) Enable API and Dashboard here, don't do in production
# api:
#   dashboard: true
#   insecure: true

# -- Change EntryPoints here...
entryPoints:
  web:
    address: :80
    # -- (Optional) Redirect all HTTP to HTTPS
    # http:
    #   redirections:
    #     entryPoint:
    #       to: websecure
    #       scheme: https
  websecure:
    address: :443
  # -- (Optional) Add custom Entrypoint
  # custom:
  #   address: :8080

# -- Configure your CertificateResolver here...
# certificatesResolvers:
#   staging:
#     acme:
#       email: [email protected]
#       storage: /etc/traefik/certs/acme.json
#       caServer: "https://acme-staging-v02.api.letsencrypt.org/directory"
#       -- (Optional) Remove this section, when using DNS Challenge
#       httpChallenge:
#         entryPoint: web
#       -- (Optional) Configure DNS Challenge
#       dnsChallenge:
#         provider: your-resolver (e.g. cloudflare)
#         resolvers:
#           - "1.1.1.1:53"
#           - "8.8.8.8:53"
#   production:
#     acme:
#       email: [email protected]
#       storage: /etc/traefik/certs/acme.json
#       caServer: "https://acme-v02.api.letsencrypt.org/directory"
#       -- (Optional) Remove this section, when using DNS Challenge
#       httpChallenge:
#         entryPoint: web
#       -- (Optional) Configure DNS Challenge
#       dnsChallenge:
#         provider: your-resolver (e.g. cloudflare)
#         resolvers:
#           - "1.1.1.1:53"
#           - "8.8.8.8:53"

# -- (Optional) Disable TLS Cert verification check
# serversTransport:
#   insecureSkipVerify: true

# -- (Optional) Overwrite Default Certificates
# tls:
#   stores:
#     default:
#       defaultCertificate:
#         certFile: /etc/traefik/certs/cert.pem
#         keyFile: /etc/traefik/certs/cert-key.pem
# -- (Optional) Disable TLS version 1.0 and 1.1
#   options:
#     default:
#       minVersion: VersionTLS12

providers:
  docker:
    # -- (Optional) Enable this, if you want to expose all containers automatically
    exposedByDefault: false
  file:
    directory: /etc/traefik
    watch: true

traefik folder: Screenshot 2024-02-17 131844

Thanks Pierre

DW4y avatar Feb 17 '24 12:02 DW4y

@DW4y, updated the docker-compose.yaml file in the main branch. Can you check if it works?

ChristianLempa avatar Feb 19 '24 08:02 ChristianLempa

@ChristianLempa i tried the new docker-compose and followed your tutorial and still got the same message as @DW4y. Folder structure of course the same as in the first question

danielschlick avatar Mar 01 '24 18:03 danielschlick

I fail to see how the screenshot titled "traefik folder" relates to the rest because the docker-compose.yaml doesn't use an /etc/traefik sub-directory on the host (and the screenshot strongly suggests to show /etc/traefik on the Docker hosts rather than showing the situation inside the container).

The docker-compose.yaml of this repository also doesn't use /etc/traefik on the host, it has done historically though, but that changed per commit https://github.com/ChristianLempa/boilerplates/commit/a81b954dcc4292d4dd245ba312c8110dbbadfad3 more than 6 months ago.

cschug avatar Mar 02 '24 14:03 cschug

got the same issue on a ubuntu server for me since i have multiple docker instance's i hopped to one using Debian and it worked like expected

svenmang2 avatar Mar 03 '24 18:03 svenmang2

@svenmang2 is it possible you had an old volume of earlier installation attempts around on your Ubuntu machine which did not play well with the changes done over the last few months? Did you try ...

$ docker compose down --remove-orphans --volumes
$ docker compose up --detach

?

cschug avatar Mar 03 '24 20:03 cschug

i could try but it was a fresh installed VM for testing purpose's so it shouldn't have any thing on it except portainer wich was also freshly installed

svenmang2 avatar Mar 03 '24 21:03 svenmang2

Getting the same error, any soloutions?

blockiindahood avatar Apr 20 '24 14:04 blockiindahood

hey sorry for the verry late response spun up another sytem using this boiler plate(as a template)

using vs code i saw that it was indeed a diractory i made the yml file using touch under a diffent file name then used CP to use the original file nmae but then portainer said it had some wierd flags on that file so i pointed the ccompase to the a file named traefik-conf this fixed it for me (- /etc/traefik/config/traefik-conf.yml:/etc/traefik/traefik.yml:ro)

the error i got when i cp-ed the file over:

"/etc/traefik/config/traefik.yml" to rootfs at "/etc/traefik/traefik.yml": mount /etc/traefik/config/traefik.yml:/etc/traefik/traefik.yml (via /proc/self/fd/6), flags: 0x5001: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

svenmang2 avatar May 06 '24 15:05 svenmang2

@svenmang2 is it possible you had an old volume of earlier installation attempts around on your Ubuntu machine which did not play well with the changes done over the last few months? Did you try ...

$ docker compose down --remove-orphans --volumes
$ docker compose up --detach

?

unfortunately i had some Nass issue's and reused the VM

svenmang2 avatar May 06 '24 15:05 svenmang2