1. Caddy version (caddy version
):
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=
2. How I run Caddy:
a. System environment:
macOS Catalina host, running inside Docker.
b. Command:
docker run -p 80:80 \
-v $PWD/index.html:/usr/share/caddy/index.html \
-v caddy_data:/data \
caddy
3. The problem I’m having:
Simply running the above command results in an error. This command is pulled from the official caddy docker image.
I believe that this issue is because of a misconfigured host, but I’m not sure how to solve it. The issue doesn’t seem to be affecting any other applications besides this one.
4. Error messages and/or full log output:
{“level”:“info”,“ts”:1590298497.854198,“msg”:“using provided configuration”,“config_file”:“/etc/caddy/Caddyfile”,“config_adapter”:“caddyfile”}
run: loading initial config: loading new config: starting caddy administration endpoint: listen tcp 45.90.28.0:2019: bind: cannot assign requested address
5. What I already tried:
Since I believe there is an issue with the host computer, I’ve spent most of my time trying to figure out what to do about host configuration. Firstly, the hosts file:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
It was modified, and I tried to make it as vanilla as possible to make sure that that is not the issue. Also, I restarted to make sure that localhost
is configured correctly.
When I run:
% host localhost
localhost.ade5bb.dns.nextdns.io has address 45.90.28.0
localhost.ade5bb.dns.nextdns.io has IPv6 address 2a07:a8c0::
I also get the same IP address that Caddy was trying to bind to. I’m not totally sure about this since I’m not sure whether the host
command ignores /etc/hosts or not. But it seems to be a clue since the address it resolves to is the same as the one caddy is trying to bind to. This address is NextDNS’s IPv4 address.
I tried changing the DNS servers to see if that would change localhost
. I changed them to Cloudflare’s DNS in my settings, resulting in a resolv.conf that looks like this:
search ade5bb.dns.nextdns.io
nameserver 1.1.1.1
nameserver 1.0.0.1
Even then, the result of host localhost
is the same and Caddy is still trying to bind to that address. I’m not totally sure what to do next.