web-server | 2022-10-01 12:41:30.943 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed web-server | web-server | java.lang.ExceptionInInitializerError: null web-server | at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:121) ~[spring-context-5.3.16.jar!/:5.3.16] web-server | at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:109) ~[spring-context-5.3.16.jar!/:5.3.16] web-server | at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:447) ~[spring-context-5.3.16.jar!/:5.3.16] web-server | at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:268) ~[spring-context-5.3.16.jar!/:5.3.16] web-server | at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:325) ~[spring-context-5.3.16.jar!/:5.3.16] web-server | at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:147) ~[spring-context-5.3.16.jar!/:5.3.16] web-server | at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:746) ~[spring-context-5.3.16.jar!/:5.3.16] web-server | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:564) ~[spring-context-5.3.16.jar!/:5.3.16] .......
解决方法
我原本的jdk版本是jdk:8。
将Dockerfile的jdk版本修改为openjdk:8
再将已经构建好的docker镜像和docker容器删掉并且重启一下docker
查看容器ID
1
docker ps -a
删除该容器
1
docker rm ID
查看镜像ID
1
docker images
删除镜像
1
docker rmi -f REPOSITORY
重启docker
1
systemctl restart docker
重新构建Dockerfile,运行容器
docker-compose.yml版本撰写错误
1 2
ERROR: Version in"./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the `services` key, or omit the `version` key and place your service definitions at the root of the file to use version 1. For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/