Caddy hasn't made a valid SSL certificate after migration

the .env seems one-off setting during initalize, and change it manually afterwards seems won’t overwrite the setting.

for quick check and fix, I usually rebuild a new container if any change is required.

here is an example for my setting, this is for podman but I assume docker should work well also.
(keep in mind you will require to remove existing caddy container before the script)

Remark: you should provide the default installation location as well into variable FZ_INSTALL_DIR

declare the caddy config and FZ_INSTALL_DIR

tlsOpts=" tls { on_demand }"
FZ_INSTALL_DIR=

once you have declare both variable , you can then execute the command:

docker run --name caddy -dt --network=host --privileged --entrypoint “/bin/sh” -v ${FZ_INSTALL_DIR:-.}/caddy:/data/caddy:Z Docker -c "cat <<@EOF > /etc/caddy/Caddyfile && ( cd /etc/caddy; caddy fmt --overwrite; caddy run --config /etc/caddy/Caddyfile --adapter caddyfile )

https:// {
log
reverse_proxy 172.25.0.100:13000
${tlsOpts:-}
}
"@EOF

you may then able to restart caddy container, the config is saved.