Docker: Let's encrypt error "Domain name contains an invalid character"
This documentation is part of the HTTPS routing guide. View the full guide here: How to manage HTTP routing and TLS encryption (HTTPS) in your Docker containers.
Welcome to the Stackhero documentation
Stackhero provides a ready-to-use Docker cloud CaaS (Containers as a Service) platform, designed for fast and reliable container deployments:
- Deploy to production with a single
docker-compose up. There is no extra setup: just start your containers.- Pick your own domain name, secured automatically with HTTPS (for example: https://api.your-company.com, https://www.your-company.com, or https://backoffice.your-company.com).
- Benefit from strong performance and robust security on private, dedicated infrastructure.
- Apply updates with one click for simple, low-effort maintenance.
You can have your containers live in production in about five minutes. Stackhero manages the infrastructure, updates, and security for you, so you can focus on delivering your applications. Read more about Docker CaaS cloud hosting.
When creating a subdomain, Let's Encrypt follows RFC 952 and 1123, which allow only characters in the set [a-zA-Z0-9-].
Although underscores ('_') are permitted in DNS record names, they are not acceptable in hostnames. As a result, Let's Encrypt rejects subdomains such as "my_subdomain.example.com" and displays the error "Domain name contains an invalid character".
To resolve this issue, simply remove any underscores from your subdomains.