I am using Docker Compose for multi-container application I have two docker-files one for tomcat and one for ant first tomcat docker file build successfully and when the ant docker-file build my application it required tomcat/lib folder and tomcat/webapps which is present in another container so how i get the tomcat folder present in tomcat container in ant container so that my application will build successfully
now i am getting an error
tomcat/lib not found...
my docker-compose.yml :
version: '3'
services:
ant:
build:
context: "."
dockerfile: dockerfile_ant
container_name: ant-container
volumes:
- ant:/usr/local/tomcat:ro
links:
- tomcat
ports:
- "8080:8080"
tomcat:
build:
context: "."
dockerfile: dockerfile_tomcat
container_name: tomcat-container
volumes:
- ant:/usr/local/tomcat:rw
expose:
- 80
volumes:
ant:
my dockerfile_ant:
FROM openjdk:6
MAINTAINER shri
ENV ANT_HOME /usr/local/ant
ENV PATH ${PATH}:/usr/local/ant/bin
ENV ANT_OPTS=-Dfile.encoding=cp1252
ADD apache-ant-1.7.0 /usr/local/ant
ADD TemplateUI /usr/local/TemplateUI
WORKDIR /usr/local/TemplateUI
ENV JAVA_TOOL_OPTIONS=-Dfile.encoding=cp1252
RUN ant
My dockerfile_tomcat:
FROM tomcat:6
ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME"
VOLUME ant
WORKDIR /usr/local/tomcat
EXPOSE 8009
Please guide us in which way you can run your multi-container application using docker compose .
Thanks shriyash
this is the docker-compose.yml:-
version: '3.2'
services:
ant:
build:
context: "."
dockerfile: dockerfile_ant
container_name: ant-container
links:
- tomcat
volumes:
- ant:/usr/local/tomcat:rw
ports:
- "8080:8080"
tomcat:
build:
context: "."
dockerfile: dockerfile_tomcat
container_name: tomcat-container
restart: always
volumes:
- ant:/usr/local/tomcat:rw
expose:
- 80
volumes:
ant: {}
and no need to specify volume in ant-dockerfile and tomcat-dockerfile
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With