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: permission denied #262

Closed ShockedCoder closed 1 year ago

ShockedCoder commented 1 year ago

It cannot read the Caddyfile even though its permissions are 0644 and it still can't read it even when the perms are 0777. I've tried everything that I could think of, but I can't find any other instance of this happening. And I've tried it with the default docker-compose.yml and that also didn't work.

Some more info in-case it's needed:

docker-compose.yml:

version: '3.3'
networks:
  caddy:
services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    container_name: caddy
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./Caddyfile:/etc/caddy/Caddyfile
      - ./site:/srv
      - ./caddy_data:/data
      - ./caddy_config:/config
    networks:
      - caddy
volumes:
  caddy_data:
    external: true
  caddy_config:

Caddyfile permission denied

tosti007 commented 1 year ago

I am experiencing the same issue. So far I have found this thread, where the problem seemed to be incorrect file permissions.

My setup:

What I have tried:

I am not sure where to go with debugging atm, if you need more specs or need me to try something let me know!

tosti007 commented 1 year ago

After some digging around I found this issue, which, although being version 1.4.4 rather than the 4.2.0 currently, seemed to be the case for me. Following the advice there solved it! @ShockedCoder does this solve it for you too?

Edit: Just for people looking for a tldr: You are maybe using SELinux, which comes with stricter permissions, mounting the volume with dir:dir:Z should solve it. You can also mount the folder with dir:dir:z to mark the folder as being shared with other containers too.

ShockedCoder commented 1 year ago

SELinux, the fucking bane of my existence.

And yes, it started working now, thank you for your help. Thank you very much.

francislavoie commented 1 year ago

Thanks for following up!