Swag generate new certificate without re-creating container

I am using the swag container to host a website. Now I want to add another domain to this host.

  • I have added the domain configuration to /var/lib/docker/volumes/swag/_data/nginx/site-confs
  • And created the website folder in /var/lib/docker/volumes/swag/_data/www/$newdomain/html
  • I have also created an index.html file and I can see it’s contents when browsing to www.$newdomain.com

Is there a way to generate a certificate for this domain, without deleting and re-creating the container?

I tried this

docker exec \
 swag \
 certbot certonly \
 --pre-hook "pkill -9 -ef nginx" \
 --standalone \
 --non-interactive \
 --agree-tos \
 --redirect \
 -m $emailaddress \
 -d $domain \
 -d www.$domain \
 --post-hook "exec /usr/sbin/nginx -c /config/nginx/nginx.conf"

I didn’t get any errors but the certificate was not generated.

I was hoping there might be a Docker Mod that might allow me to do this but I don’t know if that’s what they were meant to do.

Is there a way to generate a certificate for this domain, without deleting and re-creating the container?

we dont support any of what you’re trying to do. If you can figure it out, more power to you, but note that we will not offer support if it breaks. FWIW though, you can just pull and up -d if you are adding subdomains to a list. if you dont want to restart anymore, use a wildcard certificate.