abiosoft / caddy-docker

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

open /usr/share/caddy/access.log permission denied #171

Closed philipposkhos closed 5 years ago

philipposkhos commented 5 years ago

Hi, I used docker-compose to mount the volumes to the docker container. Everything works fine until I tried to mount the log volume into the container and set a log command into the Caddyfile that came out a error

open /var/log/caddy/access.log: permission denied

I tried to find the online solutions (like chmod the file to 777 permission, change the log directory) but nothing helped. Is there anyone has a idea for this issue?

My caddyfile

 x.x.x.x:80 {
     gzip
     log /var/log/caddy/access.log {
         rotate_size 50
         rotate_age  30
         rotate_keep 20
         rotate_compress
     }
 }

My docker compose file

version: '3'
services:
    caddy:
        image: abiosoft/caddy:latest
        volumes:
            - ./CaddyCerts/:/etc/CaddyCerts
            - ./Caddyfile:/etc/Caddyfile
            - ./log/caddy/:/var/log/caddy/
        environment:
            - CADDYPATH:"/etc/CaddyCerts"
        ports:
            - "80:80"
            - "443:443"

My OS Version

CentOS Linux release 7.6.1810 (Core)

Thanks for any idea.

philipposkhos commented 5 years ago

I found out this is because of Docker version. It is all right after I installed the newest version of docker. Thanks