caddyserver / caddy-docker

Source for the official Caddy v2 Docker Image
https://hub.docker.com/_/caddy
Apache License 2.0
405 stars 74 forks source link

Caddyfile does not mount to the docker container #268

Closed cgsmith closed 1 year ago

cgsmith commented 1 year ago

This is my docker-compose.yml:

version: "3.7"

services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/caddy_data:/data
      - ${DATA_FOLDER}/caddy_config:/config
      - ${DATA_FOLDER}/caddy_config/Caddyfile:/etc/caddy/Caddyfile

volumes:
  caddy_data:
    external: true
  caddy_config:

When running docker-compose up -d I receive the following error:

root@n8n:~/docker-caddy# docker-compose up Removing docker-caddy_caddy_1 Recreating 15dfc1d97613_docker-caddy_caddy_1 ... Recreating 15dfc1d97613_docker-caddy_caddy_1 ... error

ERROR: for 15dfc1d97613_docker-caddy_caddy_1 Cannot start service caddy: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/root/digital-ocean/caddy_config/Caddyfile" to rootfs at "/etc/caddy/Caddyfile" caused: mount through procfd: 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:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/root/digital-ocean/caddy_config/Caddyfile" to rootfs at "/etc/caddy/Caddyfile" caused: mount through procfd: 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.

# docker-compose --version
docker-compose version 1.27.4, build 40524192
# docker --version
Docker version 20.10.7, build f0df350
# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
cgsmith commented 1 year ago

${DATA_FOLDER} was wrong...