一·背景描述
- docker Version 18.06.0-ce-win72 (19098)
- jdk版本9
- spring boot应用
二·操作步骤
- 拉取应用容器依赖环境jdk9:
docker pull java:9 - 编写应用Dockerfile
FROM java:9
MAINTAINER WangBin
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/shanghai" > /etc/timezone
ENV LANG zh_CN.UTF-8
ENV LANGUAGE zh_CN:zh
ENV LC_ALL zh_CN.UTF-8
ADD ./tiebazs-2.0.jar tiebazs-2.0.jar
ADD ./application.properties application.properties
ADD ./application-miniapp.properties application-miniapp.properties
ADD ./application-pro.properties application-pro.properties
ADD ./application-test.properties application-test.properties
ADD ./ip2region.db ip2region.db
ADD ./logback-boot.xml logback-boot.xml
ADD ./logback-boot-pro.xml logback-boot-pro.xml
EXPOSE 5210
ENTRYPOINT ["java","-jar","/tiebazs-2.0.jar"]
- 运行应用
docker run –name tiebazs -d -p 5210:5210 tiebazs - 访问程序接口 日志出现如下错误
WARN 2018-09-12 16:44:17.424 [main] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'signCallBack': Unsatisfied dependency expressed through field 'miniAppService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'miniAppServiceImpl': Unsatisfied dependency expressed through field 'wxService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wxMaService' defined in class path resource [com/tiebazs/config/WxMaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [cn.binarywang.wx.miniapp.api.WxMaService]: Factory method 'wxMaService' threw exception; nested exception is java.lang.ExceptionInInitializerError - Caller+0 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:558)
INFO 2018-09-12 16:44:17.439 [main] - {dataSource-1} closed - Caller+0 at com.alibaba.druid.pool.DruidDataSource.close(DruidDataSource.java:1823)
INFO 2018-09-12 16:44:17.571 [main] - Stopping service [Tomcat] - Caller+0 at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:180)
ERROR 2018-09-12 16:44:17.626 [Tomcat-startStop-1] - A child container failed during stop - Caller+0 at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:182)
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:997)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1437)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1426)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1161)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:238)
... 6 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [WebappLoader[]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:238)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5514)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
... 6 common frames omitted
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field static final java.util.concurrent.ConcurrentMap java.io.ObjectStreamClass$Caches.localDescs accessible: module java.base does not "opens java.io" to unnamed module @73671c79
at java.base/jdk.internal.reflect.Reflection.throwInaccessibleObjectException(Reflection.java:427)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:201)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:171)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:165)
at org.apache.catalina.loader.WebappClassLoaderBase.clearCache(WebappClassLoaderBase.java:2192)
at org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesObjectStreamClassCaches(WebappClassLoaderBase.java:2180)
at org.apache.catalina.loader.WebappClassLoaderBase.clearReferences(WebappClassLoaderBase.java:1555)
at org.apache.catalina.loader.WebappClassLoaderBase.stop(WebappClassLoaderBase.java:1500)
at org.apache.catalina.loader.WebappLoader.stopInternal(WebappLoader.java:447)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
... 8 common frames omitted
ERROR 2018-09-12 16:44:17.628 [main] - A child container failed during stop - Caller+0 at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:182)
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat].StandardHost[localhost]]
at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:997)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:483)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:814)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
at org.apache.catalina.startup.Tomcat.stop(Tomcat.java:377)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stopTomcat(TomcatWebServer.java:247)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.stop(TomcatWebServer.java:301)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.stopAndReleaseWebServer(ServletWebServerApplicationContext.java:309)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
at com.tiebazs.PlatApplication.main(PlatApplication.java:20)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:538)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.apache.catalina.LifecycleException: Failed to stop component [StandardEngine[Tomcat].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:238)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1437)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1426)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1161)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.apache.catalina.LifecycleException: A child container failed during stop
at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:1004)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:226)
... 6 common frames omitted
INFO 2018-09-12 16:44:17.637 [main] -
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. - Caller+0 at org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener.logAutoConfigurationReport(ConditionEvaluationReportLoggingListener.java:101)
ERROR 2018-09-12 16:44:17.642 [main] - Application run failed - Caller+0 at org.springframework.boot.SpringApplication.reportFailure(SpringApplication.java:842)
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'signCallBack': Unsatisfied dependency expressed through field 'miniAppService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'miniAppServiceImpl': Unsatisfied dependency expressed through field 'wxService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wxMaService' defined in class path resource [com/tiebazs/config/WxMaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [cn.binarywang.wx.miniapp.api.WxMaService]: Factory method 'wxMaService' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1348)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:395)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:327)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243)
at com.tiebazs.PlatApplication.main(PlatApplication.java:20)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:538)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'miniAppServiceImpl': Unsatisfied dependency expressed through field 'wxService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wxMaService' defined in class path resource [com/tiebazs/config/WxMaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [cn.binarywang.wx.miniapp.api.WxMaService]: Factory method 'wxMaService' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:587)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:91)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:373)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1348)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)
... 27 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wxMaService' defined in class path resource [com/tiebazs/config/WxMaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [cn.binarywang.wx.miniapp.api.WxMaService]: Factory method 'wxMaService' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1254)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1103)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:317)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:251)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1138)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1065)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:584)
... 40 common frames omitted
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [cn.binarywang.wx.miniapp.api.WxMaService]: Factory method 'wxMaService' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:579)
... 52 common frames omitted
Caused by: java.lang.ExceptionInInitializerError: null
at java.base/javax.crypto.JceSecurityManager.<clinit>(JceSecurityManager.java:65)
at java.base/javax.crypto.Cipher.getConfiguredPermission(Cipher.java:2606)
at java.base/javax.crypto.Cipher.getMaxAllowedKeyLength(Cipher.java:2630)
at java.base/sun.security.ssl.CipherSuite$BulkCipher.isUnlimited(CipherSuite.java:602)
at java.base/sun.security.ssl.CipherSuite$BulkCipher.<init>(CipherSuite.java:574)
at java.base/sun.security.ssl.CipherSuite$BulkCipher.<clinit>(CipherSuite.java:460)
at java.base/sun.security.ssl.CipherSuite.<clinit>(CipherSuite.java:1074)
at java.base/sun.security.ssl.SSLContextImpl.getApplicableSupportedCipherSuiteList(SSLContextImpl.java:353)
at java.base/sun.security.ssl.SSLContextImpl.access$100(SSLContextImpl.java:41)
at java.base/sun.security.ssl.SSLContextImpl$AbstractTLSContext.<clinit>(SSLContextImpl.java:589)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:300)
at java.base/java.security.Provider$Service.getImplClass(Provider.java:1844)
at java.base/java.security.Provider$Service.newInstance(Provider.java:1820)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at java.base/javax.net.ssl.SSLContext.getInstance(SSLContext.java:169)
at org.apache.http.ssl.SSLContexts.createDefault(SSLContexts.java:51)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.getSocketFactory(SSLConnectionSocketFactory.java:174)
at me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder.<init>(DefaultApacheHttpClientBuilder.java:61)
at me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder.<init>(DefaultApacheHttpClientBuilder.java:44)
at me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder$SingletonHolder.<clinit>(DefaultApacheHttpClientBuilder.java:291)
at me.chanjar.weixin.common.util.http.apache.DefaultApacheHttpClientBuilder.get(DefaultApacheHttpClientBuilder.java:80)
at cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl.initHttp(WxMaServiceImpl.java:85)
at cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl.setWxMaConfig(WxMaServiceImpl.java:265)
at com.tiebazs.config.WxMaConfiguration.wxMaService(WxMaConfiguration.java:45)
at com.tiebazs.config.WxMaConfiguration$$EnhancerBySpringCGLIB$$47a73078.CGLIB$wxMaService$1(<generated>)
at com.tiebazs.config.WxMaConfiguration$$EnhancerBySpringCGLIB$$47a73078$$FastClassBySpringCGLIB$$af78a7e8.invoke(<generated>)
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:361)
at com.tiebazs.config.WxMaConfiguration$$EnhancerBySpringCGLIB$$47a73078.wxMaService(<generated>)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:538)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 53 common frames omitted
Caused by: java.lang.SecurityException: Can not initialize cryptographic mechanism
at java.base/javax.crypto.JceSecurity.<clinit>(JceSecurity.java:118)
... 89 common frames omitted
Caused by: java.lang.SecurityException: Can't read cryptographic policy directory: unlimited
at java.base/javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:324)
at java.base/javax.crypto.JceSecurity.access$000(JceSecurity.java:73)
at java.base/javax.crypto.JceSecurity$1.run(JceSecurity.java:109)
at java.base/javax.crypto.JceSecurity$1.run(JceSecurity.java:106)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/javax.crypto.JceSecurity.<clinit>(JceSecurity.java:105)
... 89 common frames omitted
三·解决方案
导致问题的大概原因:进入容器后发现jdk目录下缺少conf目录 ,本地把conf目录拷贝到容器后 问题解决,但还是报其他错误,可以确定非程序问题,而是运行环境问题,那么就自己创建一个jdk环境吧
1·下载jdk Linux版到本地
2·自己制作jdk镜像的 Dockerfile
FROM buildpack-deps:sid-scm
MAINTAINER WangBin
ADD jdk-10.0.2 jdk-10.0.2
ENV JAVA_HOME=/jdk-10.0.2
ENV PATH=$JAVA_HOME/bin:$PATH
ENV CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
3·docker build -t java10 -f Dockerfile .
4·然后我们把操作步骤二的 FROM java:9改成自己制作的java10即可