Docker – Run Wildfly standalone

  docker, java, wildfly

I have a Ubuntu server with a WildFly standalone installation configured, here i have a Java app that is accesible on port 80, i want to dockerize it. When create the container, i’m copying the entire WildFly directory from my local storage to the container, but when i run the command docker run -d --name dej_website -p 80:80 wildfly_dej_website:2.0 the container doesn’t start, i don’t know where should i execute the command ./standalone.sh -b 0.0.0.0

What am i doing wrong? How can i do to run this container, with the configured server?

This is my dockerfile

FROM centos

#INSTALL JAVA
RUN yum -y install java-11-openjdk
RUN java -version
#CREATE DIRECTORY TO SAVE WILDFLY
RUN mkdir /opt/DEJ_Wildfly/

#SET OPT AS WORK DIRECTORY
WORKDIR /opt/DEJ_Wildfly/

#COPY WILDFLY SERVER
COPY wildfly-11.0.0.Final .
WORKDIR /opt/DEJ_Wildfly/wildfly-11.0.0.Final/bin/

#EXPOSE 80

This is the log of docker build --tag wildfly_dej_website:2.0 . command:

Sending build context to Docker daemon  597.4MB
Step 1/10 : FROM centos
---> 300e315adb2f
Step 2/10 : RUN yum -y install java-11-openjdk
---> Using cache
---> f333f6149e02
Step 3/10 : RUN java -version
---> Using cache
---> 0110143899c7
Step 4/10 : RUN mkdir /opt/DEJ_Wildfly/
---> Running in df473b0c71f2
Removing intermediate container df473b0c71f2
---> 867e22b215af
Step 5/10 : WORKDIR /opt/DEJ_Wildfly/
---> Running in f526fbe6296c
Removing intermediate container f526fbe6296c
---> 611d78d4be81
Step 6/10 : COPY wildfly-11.0.0.Final .
---> 97fc8c5e8548
Step 7/10 : RUN pwd
---> Running in ea7496916c55
/opt/DEJ_Wildfly
Removing intermediate container ea7496916c55
---> 537932b91146
Step 8/10 : WORKDIR /opt/DEJ_Wildfly/wildfly-11.0.0.Final/bin/
---> Running in fd98f0677719
Removing intermediate container fd98f0677719
---> d88c0d774c84
Step 9/10 : RUN pwd
---> Running in fc6618268b21
/opt/DEJ_Wildfly/wildfly-11.0.0.Final/bin
Removing intermediate container fc6618268b21
---> 00aa800f611a
Step 10/10 : RUN ls
---> Running in 9e282eed66da
Removing intermediate container 9e282eed66da
---> 55fbb6c58281
Successfully built 55fbb6c58281
Successfully tagged wildfly_dej_website:2.0

This is the list of containers:

CONTAINER ID   IMAGE                     COMMAND      CREATED         STATUS                     PORTS     NAMES
dae539261cc6   wildfly_dej_website:2.0   "/bin/bash"  4 seconds ago   Exited (0) 3 seconds ago             dej_website

Source: Docker Questions

LEAVE A COMMENT