Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caddyfile: permission denied #262

Closed
ShockedCoder opened this issue Sep 21, 2022 · 4 comments
Closed

Caddyfile: permission denied #262

ShockedCoder opened this issue Sep 21, 2022 · 4 comments

Comments

@ShockedCoder
Copy link

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
Copy link

tosti007 commented Sep 27, 2022

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

My setup:

  • Fedora CoreOS
  • Raspberry Pi 4
  • Image e4fd3ed314bb.

What I have tried:

  • Running it on my local machine, which does not give the error
  • Setting permissions of the Caddyfile to 777
  • Using user 1000 as owner of the Caddyfile
  • Using root as the owner of the Caddyfile
  • Mounting an entire folder to /etc/caddy with a Caddyfile

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
Copy link

tosti007 commented Sep 28, 2022

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
Copy link
Author

ShockedCoder commented Oct 2, 2022

SELinux, the fucking bane of my existence.

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

@francislavoie
Copy link
Member

Thanks for following up!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants