Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
content:serverbasics:docker-caddy [2024/01/08 19:39] – Daniel | content:serverbasics:docker-caddy [2024/09/08 18:48] (aktuell) – [Create Caddy Yaml] Daniel | ||
---|---|---|---|
Zeile 11: | Zeile 11: | ||
===== DNS- Records ===== | ===== DNS- Records ===== | ||
- | You will also need a domainname like '' | + | You will also need a domainname like '' |
+ | |||
==== Register some Domain ==== | ==== Register some Domain ==== | ||
Zeile 33: | Zeile 35: | ||
For me, this would be '' | For me, this would be '' | ||
Change to that directory and create the following docker-compose.yml file in it, putting in the following: | Change to that directory and create the following docker-compose.yml file in it, putting in the following: | ||
+ | |||
< | < | ||
- | |||
- | version: " | ||
- | |||
services: | services: | ||
caddy: | caddy: | ||
Zeile 51: | Zeile 51: | ||
cap_add: | cap_add: | ||
- NET_ADMIN | - NET_ADMIN | ||
- | # initially i wanted | + | healthcheck: |
- | # it turned out not to work in rootless- mode for security reasons | + | test: "wget --no-verbose --tries=1 --spider https:// |
- | # so don't use host- mode. to access local services take the hostname directly, maybe define it static and add it to / | + | interval: " |
- | # e.g. pcserver: | + | timeout: " |
- | # NOT localhost: | + | start_period: |
+ | retries: 3 | ||
+ | # Be sure, that docker daemon has access | ||
+ | # This can be archived by: | ||
+ | # setcap cap_net_bind_service=+ep / | ||
+ | # | ||
+ | # To access local services, take the hostname directly, maybe define it static and add it to / | ||
+ | # Mind, that the ports must be pubilshed by the other containers to the host via ports or expose, or add them to the network | ||
+ | # e.g. pcserver: | ||
+ | #Do NOT use networkmode: | ||
# network_mode: | # network_mode: | ||
- | # set / | ||
- | # net.ipv4.ip_unprivileged_port_start = 80 | ||
- | # net.ipv4.ip_unprivileged_port_start = 443 | ||
- | # can also be set without booting: sysctl key = value | ||
ports: | ports: | ||
- " | - " | ||
Zeile 68: | Zeile 73: | ||
volumes: | volumes: | ||
caddy_data: | caddy_data: | ||
- | driver: local | ||
- | driver_opts: | ||
- | device: "" | ||
- | type: "" | ||
- | o: " | ||
caddy_config: | caddy_config: | ||
- | driver: local | ||
- | driver_opts: | ||
- | device: "" | ||
- | type: "" | ||
- | o: " | ||
caddy_certs: | caddy_certs: | ||
- | driver: local | ||
- | driver_opts: | ||
- | device: "" | ||
- | type: "" | ||
- | o: " | ||
caddy_sites: | caddy_sites: | ||
- | driver: local | ||
- | driver_opts: | ||
- | device: "" | ||
- | type: "" | ||
- | o: " | ||
</ | </ | ||
- | Also, check that your Firewall has those Ports open on your hosts and that Port Forwarding in your Router is enabled for ipv4 and for ipv6 that the host+ports are not blocked. | + | Also, check that your Firewall has those Port 80 + 443 open on your host and that Port Forwarding in your Router is enabled for ipv4 and for ipv6. |
===== Caddy Configuration ===== | ===== Caddy Configuration ===== | ||
Zeile 107: | Zeile 93: | ||
</ | </ | ||
- | replace mylocalhostname with your actual hostname (can be found out by calling hostname in your terminal). | + | replace |
Don't use localhost - see above. If you do not have a clue which hostname you have, better specify some fixed one which you can freely chose and edit ''/ | Don't use localhost - see above. If you do not have a clue which hostname you have, better specify some fixed one which you can freely chose and edit ''/ | ||
+ | |||
+ | |||
===== Fetch and run the Caddy Container ===== | ===== Fetch and run the Caddy Container ===== | ||