我需要在Docker Image中的不同端口上运行Apache和两个JAR文件(对于apache为80,对于两个JAR Tomcat,为8080和8070)。问题是,其中三个并非并行开始。我分享了我的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