You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a VPS and I just had some issues with Kinsing virus for docker infecting all of my containers. From that, I changed the way that I do things.
I generally use Caddy2 as a reverse_proxy for all of my containers, but I migrated caddy from bare metal to inside a docker container, too. I now don't expose ports within containers, and use caddy to connect directly to the hostname and port of the docker container.
It's working really great so far, but I have one issue.
I have my caddfile saved as ~/.caddy which systemlinks to /etc/caddy/Caddyfile and in my caddy docker container, I've attached a volume for /etc/caddy/Caddyfile:/etc/caddy/Caddyfile. The workflow I had in mind was to edit ~/.caddy (so I don't need root permissions), and then format, validate, and then reload caddy. I do this by using a justfile;
~> nvim ~/.caddy
[ make changes ]
~> just caddy-reload
[ caddy fmt, caddy validate, then caddy reload from within the docker container ]
It all seems to work exceptionally well with one minor hitch. To get the changes to reflect from within caddy, I have to actually restart the container.
Any ideas?
The text was updated successfully, but these errors were encountered:
Try to mount a folder onto /etc/caddy rather than the Caddyfile directly (this means your config file needs to be named Caddyfile on the host). The trouble is usually with the editing software you use to edit the config file. If you use one that changes the inode of the file when saving, then Docker doesn't track the change to the file. E.g. try using nano instead of vim, they save the file differently. Mounting the parent folder instead of the file sidesteps that issue.
Yeah, this is a weird issue. I can't tell if it's a caddy issue or my environment. I tried using nano and got the same thing.
I tried to bind /etc/caddy/:/etc/caddy/ and within /etc/caddy on the host is Caddyfile which is slinked to ~/.caddy, but no go;
Error: reading config from file: open /etc/caddy/Caddyfile: no such file or directory
I tried to bind ~/.caddy:/etc/caddy/Caddyfile but ended up getting the same issue (even with nano). I edited ~/.caddy and reloaded via my justfile, and the docker log shows this on restart;
I have a VPS and I just had some issues with Kinsing virus for docker infecting all of my containers. From that, I changed the way that I do things.
I generally use Caddy2 as a reverse_proxy for all of my containers, but I migrated caddy from bare metal to inside a docker container, too. I now don't expose ports within containers, and use caddy to connect directly to the hostname and port of the docker container.
My Caddyfile looks a bit like this;
It's working really great so far, but I have one issue.
I have my caddfile saved as
~/.caddy
which systemlinks to/etc/caddy/Caddyfile
and in my caddy docker container, I've attached a volume for/etc/caddy/Caddyfile:/etc/caddy/Caddyfile
. The workflow I had in mind was to edit~/.caddy
(so I don't need root permissions), and then format, validate, and then reload caddy. I do this by using a justfile;So I edit my caddyfile;
It all seems to work exceptionally well with one minor hitch. To get the changes to reflect from within caddy, I have to actually restart the container.
Any ideas?
The text was updated successfully, but these errors were encountered: