2017-08-11 92 views
1

我想在Wildfly上啓動docker-cli.sh腳本。Dockerfile啓動jboss cli失敗

FROM jboss/wildfly:10.0.0.Final 
 

 
COPY maven/config /opt/jboss/wildfly/standalone/configuration/ 
 
COPY maven/deployments /opt/jboss/wildfly/standalone/deployments/ 
 
COPY maven/postgres-module /opt/jboss/wildfly/modules/org/postgresql/main/ 
 

 
RUN mkdir -p wildfly/modules/org/postgresql/main 
 

 
RUN wildfly/bin/add-user.sh admin admin --silent 
 

 
RUN wildfly/bin/jboss-cli.sh --connect --controller=localhost:9990 
 

 

 
CMD ["wildfly/bin/standalone.sh","-b","0.0.0.0","-bmanagement", "0.0.0.0"]

這是我的泊塢窗文件。 如果我想用(https://github.com/fabric8io/docker-maven-plugin)MVN泊塢窗構建它:建立,我面臨以下錯誤:

命令 'wildfly /斌/ jboss-cli.sh --connect --controller =本地主機:9990' 返回一個非零的代碼:1 - > [Help 1]

但是,如果我評論,第二行並執行它,它的工作原理。

如果我在容器啓動後,用Kitemanic連接docker cli,我可以執行這個腳本步驟。

錯誤日誌:

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.21.0:build (default-cli) on project country_service: Unable to build image [company_service] : The command 'wildfly/bin/jboss-cli.sh --connect --controller=localhost:9990' returned a non-zero code: 1 -> [Help 1] 
 
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:docker-maven-plugin:0.21.0:build (default-cli) on project country_service: Unable to build image [company_service] : The command 'wildfly/bin/jboss-cli.sh --connect --controller=localhost:9990' returned a non-zero code: 1 
 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) 
 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 
 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 
 
     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 
 
     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 
 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) 
 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) 
 
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) 
 
     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) 
 
     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) 
 
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) 
 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
 
     at java.lang.reflect.Method.invoke(Method.java:497) 
 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 
 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 
 
     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 
 
     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 
 
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to build image [company_service] : The command 'wildfly/bin/jboss-cli.sh --connect --controller=localhost:9990' returned a non-zero code: 1 
 
     at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:226) 
 
     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) 
 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 
 
     ... 20 more 
 
Caused by: io.fabric8.maven.docker.access.DockerAccessException: Unable to build image [company_service] : The command 'wildfly/bin/jboss-cli.sh --connect --controller=localhost:9990' returned a non-zero code: 1 
 
     at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.buildImage(DockerAccessWithHcClient.java:220) 
 
     at io.fabric8.maven.docker.service.BuildService.doBuildImage(BuildService.java:160) 
 
     at io.fabric8.maven.docker.service.BuildService.buildImage(BuildService.java:124) 
 
     at io.fabric8.maven.docker.service.BuildService.buildImage(BuildService.java:60) 
 
     at io.fabric8.maven.docker.BuildMojo.buildAndTag(BuildMojo.java:58) 
 
     at io.fabric8.maven.docker.BuildMojo.executeInternal(BuildMojo.java:44) 
 
     at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:223) 
 
     ... 22 more 
 
Caused by: io.fabric8.maven.docker.access.DockerAccessException: The command 'wildfly/bin/jboss-cli.sh --connect --controller=localhost:9990' returned a non-zero code: 1 
 
     at io.fabric8.maven.docker.access.chunked.BuildJsonResponseHandler.process(BuildJsonResponseHandler.java:25) 
 
     at io.fabric8.maven.docker.access.chunked.EntityStreamReaderUtil.processJsonStream(EntityStreamReaderUtil.java:26) 
 
     at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient$HcChunkedResponseHandlerWrapper.handleResponse(DockerAccessWithHcClient.java:652) 
 
     at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate$StatusCodeCheckerResponseHandler.handleResponse(ApacheHttpClientDelegate.java:172) 
 
     at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222) 
 
     at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) 
 
     at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139) 
 
     at io.fabric8.maven.docker.access.hc.ApacheHttpClientDelegate.post(ApacheHttpClientDelegate.java:102) 
 
     at io.fabric8.maven.docker.access.hc.DockerAccessWithHcClient.buildImage(DockerAccessWithHcClient.java:218) 
 
     ... 28 more

+0

您可以爲此容器發佈'docker logs'的輸出嗎? – Fotis

+0

@Fotis我添加錯誤日誌 –

回答

0

我發現了一個很好的解決方案(是從一個隊友):

<run> 
 
\t <ports> 
 
\t \t <port>8080:8080</port> 
 
\t \t <port>9990:9990</port> 
 
\t </ports> 
 
\t <extraHosts> 
 
    \t \t \t <extraHost>my_db_postgress:192.168.99.100</extraHost> 
 
\t </extraHosts> 
 
</run>

我添加到運行CONFI g一個額外的主機,並將其添加到我的standalone.xml