I am trying to test and use docker for my environment. Here is my Dockerfile
When I access the tomcat (http://localhost:8080
), I get the problem This site can’t be reached
.
Note => For window, I use http://192.168.99.100:8080/
.
Build
docker build -f Dockerfile -t docker-spring-rest .
Run
docker run -p 8080:8080 -p 3306:3306 docker-spring-rest
Dockerfile
#Prat-1 tomcat
FROM tomcat:8.5.35
COPY ./target/spring-rest.war /usr/local/tomcat/webapps/
EXPOSE 8080
#Prat-1 tomcat
FROM mysql:5.5
ENV MYSQL_ROOT_PASSWORD root
ENV MYSQL_DATABASE spring-rest
COPY ./DB.SQL /docker-entrypoint-initdb.d/
One strange thing is, If I setup only Part-1 tomcat
without mysql
, I can access http://192.168.99.100:8080/
or my application http://192.168.99.100:8080/spring-rest
Is there any missing in my file?
Googling => I checked this tomcat-mysql reference. Why they use apt-get
to install because of docker already have multiple images?
Can I use multiple FROM
like FROM tomcat, FROM mysql, FROM xxx
in single Dockerfile
?