Docker – Running Apache and Multiple JARs

I need to Run Apache and Two JAR files on different ports(say 80 for apache, 8080 and 8070 for two JAR Tomcat’s) in a Docker Image. The problem is, three of them are not starting in parallel. I have shared my DockerFile. What are the changes that need to be done here?

Dockerfile

FROM  phusion/baseimage:0.9.17

CMD ["/sbin/my_init"] && ["service", "apache2", "start"]

RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list

RUN apt-get -y update

RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -q python-software-properties software-properties-common

ENV JAVA_VER 8
ENV JAVA_HOME /usr/lib/jvm/java-8-oracle

RUN echo 'deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' >> /etc/apt/sources.list && \
    echo 'deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main' >> /etc/apt/sources.list && \
    apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C2518248EEA14886 && \
    apt-get update && \
    echo oracle-java${JAVA_VER}-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections && \
    apt-get install -y --force-yes --no-install-recommends oracle-java${JAVA_VER}-installer oracle-java${JAVA_VER}-set-default && \
    apt-get clean && \
    rm -rf /var/cache/oracle-jdk${JAVA_VER}-installer && \
    apt-get -y install apache2

RUN update-java-alternatives -s java-8-oracle

RUN echo "export JAVA_HOME=/usr/lib/jvm/java-8-oracle" >> ~/.bashrc

RUN echo "ServerName localhost" | sudo tee /etc/apache2/conf-available/fqdn.conf
RUN sudo a2enconf fqdn

RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ADD File1.jar /root/File1.jar
ADD File2.jar /root/File2.jar

# Add File1 service
RUN mkdir /etc/service/File1
ADD start-File1.sh /etc/service/File1/run
RUN chmod +x /etc/service/File1/run

# Add File2 service
RUN mkdir /etc/service/File2
ADD start-File2.sh /etc/service/File2/run
RUN chmod +x /etc/service/File2/run

  • How can i create a folder inside the shared volume with the correct permission in docker?
  • How can I keep container running on Kubernetes?
  • Request Entity Too Large - NextCloud in Docker
  • How can I link docker containers in mesos cluster (dc/os) running on Azure?
  • PID 1 in Docker persistance
  • Docker container - node application - run issue
  • Cannot dump a database in a mysql container
  • Is there a maximum number of containers running on a Docker host?
  • Assign domain name to the container
  • What are the Docker RUN params for mimicking IronWorker memory constraints?
  • cannot remove docker image, error response from daemon
  • VisualVM connection to Tomcat hosted on Docker
  • Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.