SWAG stops working at night and needs to be restarted daily

23 Mar 2023

The SWAG docker container from linuxserver.io is a great plug-and-play solution for serving websites and self-hosted docker based applications. For me it's been taking care of SSL certificate renewal and has been serving several docker based applications including Nextcloud, Vaultwarden, Jellyfin and Syncthing.

SWAG stops working at night

Recently after an upgrade to 2.4.0, I noticed all my applications were down the next morning. I logged into the server and restarted the SWAG container happily seeing that it fixed the issue.

The happiness did not last however; the day after in the morning my phone reported yet again that it's not able to synchronize my appointments. Sure enough SWAG stopped working again. To my surprise there was nothing in the logs docker logs swag and the container was up and running.

What happened?

My websites became unavailable around 2am - around this time SWAG's certbot appears to renew SSL certificates for all domains. I jumped into the container docker exec -it swag /bin/bash and manually started the process certbot renew -v. Sure enough the process errored out with

Failed to renew certificate xxx.xx with error: Some challenges have failed.

Apparently my domains failed the DNS record challange and rightfully so: They were test domains I moved to a different DNS without updating my SWAG configuration.

Removing these domains from SWAG's docker-compose.yml and running docker-compose up -d fixed the problem permanently.


SWAG nowadays seems to die after not being able to renew SSL certificates at night. If you find it stops serving your sites, log into the container and run certbot manually with the verbose flag certbot renew -v. This might shed some light on a configuration problem responsible for the downtime.

While not being able to renew SSL certificates should not be the reason to stop working altogether and should be fixed in SWAG soon, in the meantime I happily wake up to a working server.

Add new comment

The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang target> <em> <strong> <cite> <blockquote cite> <pre> <ul type> <ol start type> <li> <dl> <dt> <dd> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Get a quote in 24 hours

Wether a huge commerce system, or a small business website, we will quote the project within 24h of you pressing the following button: Get quote