Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] docker容器提示The character [_] is never valid in a domain name #3478

Open
qlanto224 opened this issue Nov 26, 2024 · 0 comments
Open

Comments

@qlanto224
Copy link

Issue Description

Type: bug report
生产使用sentinel的过程中的问题。物理机->虚拟机->容器
sca中配置spring.cloud.sentinel.transport.dashboard虚拟机的ip(192.168.3.2),可以正确连接,当改成sentinel的容器ip(132.30.0.58)时会出现这个错误。

docker-compose 配置:
version: '3'
services:  
  sentinel:
    image: sentinel-dashboard:1.8.0
    hostname: "sentinel"
    environment:
      - TZ=Asia/Shanghai
    ports:
      - 8858:8858
    restart: on-failure
    networks:
      by_net:
        ipv4_address: 132.30.0.58

networks:
  by_net:
    driver: bridge
    ipam:
      config:
        - subnet: 132.30.0.0/16

同样的docker-compose配置,本地微服务可以在sentinel中识别到,但是生产(虚拟机内的docker容器)提示:

2024-11-25 15:29:31.862  INFO 1 --- [io-8858-exec-10] o.apache.coyote.http11.Http11Processor   : The host [docker-sentinel-1.docker_by_net] is not valid
 Note: further occurrences of request parsing errors will be logged at DEBUG level.

java.lang.IllegalArgumentException: The character [_] is never valid in a domain name.
	at org.apache.tomcat.util.http.parser.HttpParser$DomainParseState.next(HttpParser.java:946) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.tomcat.util.http.parser.HttpParser.readHostDomainName(HttpParser.java:842) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.tomcat.util.http.parser.Host.parse(Host.java:66) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.tomcat.util.http.parser.Host.parse(Host.java:40) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.coyote.AbstractProcessor.parseHost(AbstractProcessor.java:286) ~[tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.coyote.http11.Http11Processor.prepareRequest(Http11Processor.java:1203) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:776) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_202]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_202]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.34.jar!/:8.5.34]
	at java.lang.Thread.run(Thread.java:748) [na:1.8.0_202]

看样子是sentinel是去解析本地网卡时,去解析hosts了,而docker的网卡配置名称是有下划线的,导致解析异常。例如:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant