abiosoft / caddy-docker

Docker container for Caddy
https://hub.docker.com/r/abiosoft/caddy/
MIT License
768 stars 315 forks source link

Error while creating caddy container #141

Closed Dulanic closed 5 years ago

Dulanic commented 5 years ago

This is the command I am using:

sudo docker run -d \
-v /docker/containers/Caddyfile:/etc/Caddyfile \
-v /docker/containers/Caddyfile/.caddy:/root/.caddy \
-p 80:80 -p 443:443 \
abiosoft/caddy

The directories exist:

drwxrwxr-x 3 dulanic dulanic 4096 Sep 17 10:20 Caddyfile

drwxrwxr-x 2 dulanic dulanic 4096 Sep 17 10:20 .caddy

dulanic@mediaserver:/docker/containers/Caddyfile$ sudo docker run -d \
> -v /docker/containers/Caddyfile:/etc/Caddyfile \
> -v /docker/containers/Caddyfile/.caddy:/root/.caddy \
> -p 80:80 -p 443:443 \
> abiosoft/caddy
67292fd80f2d4cfc104e442995554f4542d9266d673c4fbe736b8a9d283a2d67
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "process_linux.go:402: container init caused \"rootfs_linux.go:58: mounting \\\"/docker/containers/Caddyfile\\\" to rootfs \\\"/var/lib/docker/overlay2/2c4baaef7d78632c595aef79221234e562a0cd35d5a6874db74075a2da6483c3/merged\\\" at \\\"/var/lib/docker/overlay2/2c4baaef7d78632c595aef79221234e562a0cd35d5a6874db74075a2da6483c3/merged/etc/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.
abiosoft commented 5 years ago

Looks like /docker/containers/Caddyfile/ is a directory. It should be a file instead.

Dulanic commented 5 years ago

Ah OK, wasnt aware, I tried using the version you had posted, but it gave same error. I did a echo >> Caddyfile and that worked.