Docker,  技术

Docker Container的命名

因为下划线在域名中是非法的,所以HttpParser会认为这个是非法。但是在docker环境里面每一个container的名字是可能包含下划线的。当一个container试图访问另一个的时候最简单的方式就是通过container的名字,这个时候就会出错。

这个问题折腾了我2个小时。。

下面是异常

<head><title>HTTP Status 400 \u2013 Bad Request<\/title><style type=\"text/css\">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}<\/style><\/head><body><h1>HTTP Status 400 \u2013 Bad Request<\/h1><hr class=\"line\" /><p><b>Type<\/b> Exception Report<\/p><p><b>Message<\/b> The character [_] is never valid in a domain name.<\/p><p><b>Description<\/b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).<\/p><p><b>Exception<\/b><\/p><pre>java.lang.IllegalArgumentException: The character [_] is never valid in a domain name.\n\torg.apache.tomcat.util.http.parser.HttpParser$DomainParseState.next(HttpParser.java:994)\n\torg.apache.tomcat.util.http.parser.HttpParser.readHostDomainName(HttpParser.java:890)\n\torg.apache.tomcat.util.http.parser.Host.parse(Host.java:66)\n\torg.apache.tomcat.util.http.parser.Host.parse(Host.java:40)\n\torg.apache.coyote.AbstractProcessor.parseHost(

Leave a Reply

Your email address will not be published. Required fields are marked *