1. Make a jdk15 docker image. The /etc/profile environment configuration must be consistent with that in the JDk15 dockerfile. Import Windows SQL scripts into the mysql container of docker

Mysql -uroot -p123456 mysql create database denglu; Be careful to hit;sourceDenglu. SQL Run the SQL scriptCopy the code

3. Build projects

  • Jar your project into a new Linux package, and create a new Dockrfile file in the same directory as the JAR package.

Dockerfile file:

FROM jdk15:1.0 EXPOSE 8832 VOLUME /tmp1 ENV TZ=Asia/Shanghai RUN ln -sf /usr/share/zoneinfo/{TZ} /etc/localtime&&echo "{TZ}"> /etc/timezone ADD demo1-0.0.1- snapshot.jar /app1.jar RUN bash -c'touch /app1.jar'
ENTRYPOINT ["java"."-jar"."/app1.jar"]

Copy the code
docker build -t first-repository . Docker run -p 8832:8832 --name demo2 --link mymysql:mysql --link redis-test:redis First-repository -d docker ps -aCopy the code