1

I want to add camunda-bpm-wildfly with active mq and run in same docker container.

First I added them to two containers and tried to run as follows. It was OK.

1. Running camunda-bpm-wildfly.

Dockerfile :

FROM camunda/camunda-bpm-platform:wildfly-latest
ADD standalone.xml standalone/configuration/
ADD bin/ bin/
ADD fusepatch/ fusepatch/
ADD modules/ modules/
ADD hawtio-wildfly-1.5.3.war standalone/deployments/

Commands :

docker build my-wildfly .
docker images
sudo docker run -d --name my-wildfly --net="host" -p 7070:7070 my-wildfly

2. Running activemq.

Dockerfile :

FROM webcenter/activemq:latest

Commands :

docker build amq-alone .
docker images
docker run --name='amq-alone' -d -p 8161:8161 -p 61616:61616 -p 61613:61613 amq-alone 

Then I searched for a way to add two images to the same container and noted that we can't add multiple images to the same container[Ref : Docker - container with multiple images.

Then I downlaoded the activemq and I tried to extend it as follows. It builds correctly and when I run also it runs correctly. But only wildfly runs in port 7070 not the activemq.

Dockerfile :

FROM camunda/camunda-bpm-platform:wildfly-latest
ADD standalone.xml standalone/configuration/
ADD bin/ bin/
ADD fusepatch/ fusepatch/
ADD modules/ modules/
ADD hawtio-wildfly-1.5.3.war standalone/deployments/
ADD apache-activemq-5.15.2/ apache-activemq-5.15.2/
RUN apache-activemq-5.15.2/bin/activemq start

Commands :

docker build my-wildfly-amq .
docker images
sudo docker run -d --name my-wildfly-amq --net="host" -p 7070:7070 -p 8161:8161 -p 61616:61616 -p 61613:61613 my-wildfly-amq 

Log :

me@my-pc:~/$ docker build -t=my-wildfly-amq .
Sending build context to Docker daemon  375.8MB
Step 1/8 : FROM camunda/camunda-bpm-platform:wildfly-latest
 ---> 274d119b1660
Step 2/8 : ADD standalone.xml standalone/configuration/
 ---> Using cache
 ---> 41c2f6d423ec
Step 3/8 : ADD bin/ bin/
 ---> Using cache
 ---> 27c1952f442e
Step 4/8 : ADD fusepatch/ fusepatch/
 ---> Using cache
 ---> 66419d22d6b7
Step 5/8 : ADD modules/ modules/
 ---> bbdee5ab8ea2
Step 6/8 : ADD hawtio-wildfly-1.5.3.war standalone/deployments/
 ---> 237821cdb2c8
Step 7/8 : ADD apache-activemq-5.15.2/ apache-activemq-5.15.2/
 ---> 309b552b5150
Step 8/8 : RUN apache-activemq-5.15.2/bin/activemq start
 ---> Running in ce0e55cfd13b
INFO: Loading '/camunda/apache-activemq-5.15.2//bin/env'
INFO: Using java '/usr/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/camunda/apache-activemq-5.15.2//data/activemq.pid' (pid '46')
 ---> f903dc0b2db5
Removing intermediate container ce0e55cfd13b
Successfully built f903dc0b2db5
Successfully tagged my-wildfly-amq:latest

What am I missing here? How to add active mq with the camunda-bpm-wildfly running in same docker container?

UPDATE#1 : With the @bluescore 's answer I tried to use CMD as follows and it worked. Both activemq and wildfly was started. But one problem is there. Normally when we start camunda-bpm-wildfly we invokes start-camunda.sh (not the wildfly bin/standalone.sh). But here I can't see that file in -ti mode also. How to start the camunda as the image starts itself? (I checked in the dockerhub and github also but couldn't find a tip)

Dockerfile :

FROM camunda/camunda-bpm-platform:wildfly-latest
ADD standalone.xml standalone/configuration/
ADD bin/ bin/
ADD fusepatch/ fusepatch/
ADD modules/ modules/
ADD hawtio-wildfly-1.5.3.war standalone/deployments/
ADD apache-activemq-5.15.2/ apache-activemq-5.15.2/
ADD my-wildfly-amq.sh my-wildfly-amq.sh
CMD bash my-wildfly-amq.sh

my-wildfly-amq.sh

apache-activemq-5.15.2/bin/activemq start
bin/standalone.sh
  • Docker version 17.09.0-ce
  • Ubuntu 16.04
ironwood
  • 8,936
  • 15
  • 65
  • 114

1 Answers1

3

You're misunderstanding how RUN works. Use an ENTRYPOINT or CMD script in place of the final RUN command of the container you extended. RUN executes a command during a build, not during a docker run. CMD and ENTRYPOINT tell the container what to execute when it's actually ran.

Check out the Dockerfile for the camunda-bpm-platform image you're using as a base. Notice that CMD at the end, which executes a shell script.

If you want to run both ActiveMQ and wildfly, you should write a shell script that runs both of them, then replace your final RUN with a CMD or ENTRYPOINT to execute that script. Something like:

CMD ["/usr/local/bin/your_script.sh"]

When your container starts up with docker run, this script will run.

bluescores
  • 4,437
  • 1
  • 20
  • 34
  • Thanks bluescores! With your answer, I tried to use CMD as follows and it worked. Both activemq and wildfly was started. But one problem is there. Normally when we start camunda-bpm-wildfly we invokes start-camunda.sh (not the wildfly bin/standalone.sh). But here I can't see that file in -ti mode also. How to start the camunda as the image starts itself? (I checked in the dockerhub and github also but couldn't find a tip) – ironwood Dec 12 '17 at 04:51
  • Perhaps it's my ignorance with camunda/wildfly, but I don't understand the problem you're facing now. You said both activemq and wildfly started as expected, but you're asking how to start camunda as the image itself starts? Is camunda != wildfly? Anything you want to happen at image start can be scripted in my-wildfly-amq.sh and it should happen. – bluescores Dec 12 '17 at 14:21
  • Normally, we start the wildfly using the standalone.sh. But the camunda bpm wildfly distribution has another start-camunda.sh otherthan standalone.sh (ref:https://docs.camunda.org/get-started/bpmn20/install/). My initial intension was adding active mq also to the same container that camunda run. But when I added CMD to start the activemq I had to start the camunda-wildfly also. But I couldnt start it as normal way since start-camunda.sh is not found in there. I was looking for a way to start it in the same way that image starts it. Anyway your answer is more than enough for me! Thanx again. – ironwood Dec 12 '17 at 17:30
  • `start-camunda.sh` does nothing more than call `standalone.sh` and open Camunda's login page in the standard browser, see https://github.com/camunda/camunda-bpm-platform/blob/master/distro/wildfly10/assembly/src/start-camunda.sh. It's fine to run just `standalone.sh`. – thorben Dec 14 '17 at 14:21