Cannot get caddy to start via docker

I had caddy running fine but I made some changes to the yml and somehow lost my compose file, so I had to recreate it. I’m running the latest version of docker 19.03.8 build afacb8b7f0
running on ubuntu server 20.04 bare metal.

my docker compose is as follows:

version: '3.3'
services:
  jellyfin:
    container_name: jellyfin
    ports:
      - '8096:8096'
    volumes:
      - /home/mike/docker/jellyfin:/config
    image: hotio/jellyfin
    restart: unless-stopped
  caddy:
    container_name: caddy
    ports:
      - 80:80
      - 443:443
    volumes:
      - /home/mike/docker/caddy:/config
      - .Caddyfile:/etc/caddy/Caddyfile
    image: caddy
    restart: unless-stopped

When I run docker compose I am greeted with:

docker-compose up -d
jellyfin is up-to-date
Creating caddy ... error

ERROR: for caddy  Cannot start service caddy: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/home/mike/docker/.Caddyfile\\\" to rootfs \\\"/var/lib/docker/overlay2/3b18929c8543f4a6d2f7eb997db6734ee485f7d39e8077b47ab0ea2330c8f515/merged\\\" at \\\"/var/lib/docker/overlay2/3b18929c8543f4a6d2f7eb997db6734ee485f7d39e8077b47ab0ea2330c8f515/merged/etc/caddy/Caddyfile\\\" caused \\\"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

ERROR: for caddy  Cannot start service caddy: OCI runtime create failed: container_linux.go:349: starting container process caused "process_linux.go:449: container init caused \"rootfs_linux.go:58: mounting \\\"/home/mike/docker/.Caddyfile\\\" to rootfs \\\"/var/lib/docker/overlay2/3b18929c8543f4a6d2f7eb997db6734ee485f7d39e8077b47ab0ea2330c8f515/merged\\\" at \\\"/var/lib/docker/overlay2/3b18929c8543f4a6d2f7eb997db6734ee485f7d39e8077b47ab0ea2330c8f515/merged/etc/caddy/Caddyfile\\\" caused \\\"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
ERROR: Encountered errors while bringing up the project.

Any ideas?

I think it has to do with this volume mount:

      - .Caddyfile:/etc/caddy/Caddyfile

I don’t think .Caddyfile exists. Did you mean ./Caddyfile? That error message comes from Docker itself, it’s not happy with your volume mounts.

Also, please make sure to have a volume for /data, because otherwise you’ll lose your certificates and keys when your containers shut down.

Boy am I embarrassed. ONE MISSING CHARACTER and the whole thing is screwed up lol. Thank you.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.