Dockerfile commands not working

Hello, I try to generate docker image which contains wildfly with dockerfile. The dockerfile is like below,

FROM jboss/wildfly

ENV WILDFLY_VERSION 10.0.0.Final
ENV JBOSS_HOME /opt/jboss/wildfly

RUN cd $HOME
&& curl -O https://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip
&& unzip wildfly-$WILDFLY_VERSION.zip
&& mv $HOME/wildfly-$WILDFLY_VERSION $JBOSS_HOME
&& rm wildfly-$WILDFLY_VERSION.zip

RUN mkdir $JBOSS_HOME/modules/system/layers/base/com/mysql
RUN mkdir $JBOSS_HOME/modules/system/layers/base/com/mysql/main
ADD module.xml $JBOSS_HOME/modules/system/layers/base/com/mysql/main/
ADD mysql-connector-java-5.1.38-bin.jar $JBOSS_HOME/modules/system/layers/base/com/mysql/main/

ADD standalone.xml $JBOSS_HOME/standalone/configuration/
ADD Test.war $JBOSS_HOME/standalone/deployments/Test.war
ADD Test.war.deployed $JBOSS_HOME/standalone/deployments/

EXPOSE 8080

CMD $JBOSS_HOME/bin/standalone.sh -b 0.0.0.0

docker build --rm=true . command throws no fault. But Add command does not working at all. Is there any problems in docker file?
Your any advices will be deeply appreciated. Thanks

Please post the output of the build and which commands you are using to run container, docker logs of the created container, etc. Without this information we cannot help you.

Thanks for your reply. I used “docker build --rm=true .” and belows are the output.

Step 0 : FROM jboss/wildfly
Trying to pull repository docker.io/jboss/wildfly … latest: Pulling from jboss/wildfly
3690474eb5b4: Already exists
434c4358581c: Already exists
d3451720f1a0: Already exists
73a464f47545: Already exists
99ca2e2e1628: Already exists
96ee505c8d0d: Already exists
dd78c40ce708: Already exists
c660c9aa1089: Already exists
07fdaadfc1e7: Already exists
f4b51ba171d0: Already exists
4bf373e8bd56: Already exists
15679b84a7ca: Already exists
06754ad30c3a: Already exists
d9d6514e3410: Already exists
ed3908179731: Already exists
23bb143d9dc0: Already exists
08c4a4fa8d86: Already exists
5d4848b35785: Already exists
b2574cfd2ae6: Already exists
7e53a4cce241: Already exists
f66b0b1c8fec: Already exists
Digest: sha256:033d68d5cc6ec819028ddd0dd446802a68dd824263e715d4f9e2a2ee7dfe8c74
Status: Downloaded newer image for docker.io/jboss/wildfly:latest

—> f66b0b1c8fec
Step 1 : ENV WILDFLY_VERSION 10.0.0.Final
—> Using cache
—> bfe8395b8a14
Step 2 : ENV JBOSS_HOME /opt/jboss/wildfly
—> Using cache
—> 6af343104890
Step 3 : RUN cd $HOME && curl -O https://download.jboss.org/wildfly/$WILDFLY_VERSION/wildfly-$WILDFLY_VERSION.zip && unzip wildfly-$WILDFLY_VERSION.zip && mv $HOME/wildfly-$WILDFLY_VERSION $JBOSS_HOME && rm wildfly-$WILDFLY_VERSION.zip
—> Using cache
—> 9ba1576e08ae
Step 4 : RUN mkdir $JBOSS_HOME/modules/system/layers/base/com/mysql
—> Using cache
—> e5fa8f47ffd5
Step 5 : RUN mkdir $JBOSS_HOME/modules/system/layers/base/com/mysql/main
—> Using cache
—> 2ac05878c3b6
Step 6 : ADD module.xml $JBOSS_HOME/modules/system/layers/base/com/mysql/main/
—> Using cache
—> 3afd3a012673
Step 7 : ADD mysql-connector-java-5.1.38-bin.jar $JBOSS_HOME/modules/system/layers/base/com/mysql/main/
—> Using cache
—> 0dbc71d37754
Step 8 : ADD standalone.xml $JBOSS_HOME/standalone/configuration/
—> Using cache
—> b9e05616862a
Step 9 : ADD Test.war $JBOSS_HOME/standalone/deployments/Test.war
—> Using cache
—> 514783b2811a
Step 10 : ADD Test.war.deployed $JBOSS_HOME/standalone/deployments/
—> Using cache
—> 3b3e0a3ebfc8
Step 11 : EXPOSE 8080
—> Using cache
—> 51b456771b3c
Step 12 : CMD $JBOSS_HOME/bin/standalone.sh -b 0.0.0.0
—> Using cache
—> b26cc740ed3b
Successfully built b26cc740ed3b

And the container logs are

2016-03-08T10:58:59.479884156Z =========================================================================
2016-03-08T10:58:59.479926400Z
2016-03-08T10:58:59.479930004Z JBoss Bootstrap Environment
2016-03-08T10:58:59.479932294Z
2016-03-08T10:58:59.479934767Z JBOSS_HOME: /opt/jboss/wildfly
2016-03-08T10:58:59.479936788Z
2016-03-08T10:58:59.479938836Z JAVA: /usr/lib/jvm/java/bin/java
2016-03-08T10:58:59.479940787Z
2016-03-08T10:58:59.479942947Z JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true
2016-03-08T10:58:59.479946732Z
2016-03-08T10:58:59.479948726Z =========================================================================
2016-03-08T10:58:59.479950771Z
2016-03-08T10:58:59.931400671Z e[0m10:58:59,928 INFO [org.jboss.modules] (main) JBoss Modules version 1.5.1.Final
2016-03-08T10:59:00.175929929Z e[0me[0m10:59:00,173 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.6.Final
2016-03-08T10:59:00.230888943Z e[0me[0m10:59:00,230 INFO [org.jboss.as] (MSC service thread 1-8) WFLYSRV0049: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) starting
2016-03-08T10:59:01.284404742Z e[0me[0m10:59:01,282 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: Creating http management service using socket-binding (management-http)
2016-03-08T10:59:01.307958444Z e[0me[0m10:59:01,306 INFO [org.xnio] (MSC service thread 1-5) XNIO version 3.3.4.Final
2016-03-08T10:59:01.312402952Z e[0me[0m10:59:01,311 INFO [org.xnio.nio] (MSC service thread 1-5) XNIO NIO Implementation Version 3.3.4.Final
2016-03-08T10:59:01.480622098Z e[0me[0m10:59:01,476 INFO [org.wildfly.extension.io] (ServerService Thread Pool – 37) WFLYIO001: Worker ‘default’ has auto-configured to 8 core threads with 64 task threads based on your 4 available processors
2016-03-08T10:59:01.494309589Z e[0me[0m10:59:01,492 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool – 38) WFLYCLINF0001: Activating Infinispan subsystem.
2016-03-08T10:59:01.494345071Z e[0me[0m10:59:01,493 INFO [org.jboss.as.naming] (ServerService Thread Pool – 46) WFLYNAM0001: Activating Naming Subsystem
2016-03-08T10:59:01.510738628Z e[0me[0m10:59:01,509 INFO [org.jboss.as.jsf] (ServerService Thread Pool – 44) WFLYJSF0007: Activated the following JSF Implementations: [main]
2016-03-08T10:59:01.514669849Z e[0me[0m10:59:01,514 INFO [org.jboss.as.security] (ServerService Thread Pool – 53) WFLYSEC0002: Activating Security Subsystem
2016-03-08T10:59:01.523352192Z e[0me[33m10:59:01,522 WARN [org.jboss.as.txn] (ServerService Thread Pool – 54) WFLYTX0013: Node identifier property is set to the default value. Please make sure it is unique.
2016-03-08T10:59:01.527437093Z e[0me[0m10:59:01,526 INFO [org.jboss.as.security] (MSC service thread 1-7) WFLYSEC0001: Current PicketBox version=4.9.4.Final
2016-03-08T10:59:01.547991100Z e[0me[0m10:59:01,543 INFO [org.jboss.as.connector] (MSC service thread 1-8) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.3.2.Final)
2016-03-08T10:59:01.586823697Z e[0me[0m10:59:01,579 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool – 33) WFLYJCA0004: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
2016-03-08T10:59:01.610987398Z e[0me[0m10:59:01,593 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0018: Started Driver service with driver-name = h2
2016-03-08T10:59:01.629734512Z e[0me[0m10:59:01,624 INFO [org.jboss.remoting] (MSC service thread 1-6) JBoss Remoting version 4.0.18.Final
2016-03-08T10:59:01.643114643Z e[0me[0m10:59:01,626 INFO [org.jboss.as.webservices] (ServerService Thread Pool – 56) WFLYWS0002: Activating WebServices Extension
2016-03-08T10:59:01.645907431Z e[0me[0m10:59:01,642 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool – 55) WFLYUT0003: Undertow 1.3.15.Final starting
2016-03-08T10:59:01.662225040Z e[0me[0m10:59:01,643 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0003: Undertow 1.3.15.Final starting
2016-03-08T10:59:01.696086959Z e[0me[0m10:59:01,693 INFO [org.jboss.as.naming] (MSC service thread 1-7) WFLYNAM0003: Starting Naming Service
2016-03-08T10:59:01.716702604Z e[0me[0m10:59:01,710 INFO [org.jboss.as.mail.extension] (MSC service thread 1-4) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
2016-03-08T10:59:01.927951785Z e[0me[0m10:59:01,923 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool – 55) WFLYUT0014: Creating file handler for path ‘/opt/jboss/wildfly/welcome-content’ with options [directory-listing: ‘false’, follow-symlink: ‘false’, case-sensitive: ‘true’, safe-symlink-paths: ‘’]
2016-03-08T10:59:01.958096761Z e[0me[0m10:59:01,957 INFO [org.jboss.as.ejb3] (MSC service thread 1-8) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 64 (per class), which is derived from thread worker pool sizing.
2016-03-08T10:59:01.960028660Z e[0me[0m10:59:01,957 INFO [org.jboss.as.ejb3] (MSC service thread 1-4) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 16 (per class), which is derived from the number of CPUs on this host.
2016-03-08T10:59:01.970083459Z e[0me[0m10:59:01,961 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: Started server default-server.
2016-03-08T10:59:01.970124582Z e[0me[0m10:59:01,965 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0018: Host default-host starting
2016-03-08T10:59:02.056238349Z e[0me[0m10:59:02,054 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) WFLYUT0006: Undertow HTTP listener default listening on 0.0.0.0:8080
2016-03-08T10:59:02.296853068Z e[0me[0m10:59:02,291 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0001: Bound data source [java:jboss/datasources/ExampleDS]
2016-03-08T10:59:02.492614940Z e[0me[0m10:59:02,490 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) WFLYDS0013: Started FileSystemDeploymentService for directory /opt/jboss/wildfly/standalone/deployments
2016-03-08T10:59:02.675744357Z e[0me[0m10:59:02,668 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBossWS 5.1.3.Final (Apache CXF 3.1.4)
2016-03-08T10:59:02.733679293Z e[0me[0m10:59:02,726 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-2) ISPN000128: Infinispan version: Infinispan ‘Mahou’ 8.1.0.Final
2016-03-08T10:59:02.900269353Z e[0me[0m10:59:02,894 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on htp://127.0.0.1:9990/management
2016-03-08T10:59:02.900308437Z e[0me[0m10:59:02,897 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on htp://127.0.0.1:9990
2016-03-08T10:59:02.900316579Z e[0me[0m10:59:02,897 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 10.0.0.Final (WildFly Core 2.0.10.Final) started in 3296ms - Started 267 of 553 services (371 services are lazy, passive or on-demand)

As you see, Bound data source is not changed to mysql, still be [java:jboss/datasources/ExampleDS] and i can’t find any deployment in the wildfly. RUN and ADD command of Dockerfile does not work at all.

Any idea?

I found it. My file permission was wrong, so it does not worked. With chmod command, I fixed it and It worked well.
Thanks any way. :smile:

Glad to hear it worked out. Permissions can be a tricky issue inside of containers so suspecting those is usually a decent guess :slightly_smiling:

But “docker build --rm=true --tag=jboss/wildfly:1.0” generated 2 docker images.(jboss/wildfly:1.0 and docker.io/jboss/wildfly:latest ) I have no idea how to generate one exact wildfly image. Kindly inform me how to generate one exact image. Thanks.

@gladiator :latest tag gets generated automatically if no other tag is specified. jboss-wildfly:1.0 is the image you are wanting. This is default Docker behavior which cannot be removed (it doesn’t use any extra resources though, so I wouldn’t worry too much about it if you are specifying tags explicitly).

This is another question. I made the container of the image “jboss/wildfly:1.0” and run it. However http://127.0.0.1:8080 does not work, either. The container of the default image “docker.io/jboss/wildfly:latest” works well. http://127.0.0.1:8080 shows the wildfly initial page. I have no idea why the image generated by me can’t be shown?
Pls, inform me how to run the comtainer of image “jboss/wildfly:1.0” and the wildfly initial page is shown on web browser.
Thanks in advance!

@gladiator67 Check the output of the container using docker logs to hopefully find out why your tagged container isn’t running properly.

The docker command has to be executed by background like below.

CMD ["$JBOSS_HOME/bin/standalone.sh" “-b” “0.0.0.0”]

Then it works!
I really appreciate your nice advice and guide. :smile:

1 Like