报错是Connection refused: connect
yml文件中PARAMS=值前后是否加了’或者是"
如果部署docker-compose up -d 没有报错,但是页面进不去可能是端口映射问题
ports:
- 8083:8081
8083对应的是外部访问虚拟机端口,8081对应容器端口;
JDBC或者连接mysql time out相关
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
我的问题是,PARAMS:后没有用’或是"将参数包含起来
version: '3.1'
services:
xxl-job:
restart: always
image: xuxueli/xxl-job-admin:2.3.0
container_name: xxl-job
volumes:
- ./logs/:/data/applogs
ports:
- 8083:8081
environment:
PARAMS: '
--server.port=8081
--spring.datasource.url=jdbc:mysql://xxx.xxx.xx.x:3306/xxl_job?useUnicode=true&characterEncoding=UTF-8
--spring.datasource.username=root
--spring.datasource.password=root'
还有诸如各种云平台或者虚拟机,端口转发一定配置好,也有可能是拦截了!
没找到别的好用的答案,自己遇到了解决了记录一下!!!转发请备注!