zoukankan      html  css  js  c++  java
  • [Docker] Link the Java application and database Docker containers

    application-mysql.properties:

    spring.datasource.url=jdbc:mysql://ec-mysql:3306/explorecali
    spring.datasource.username=cali_user
    spring.datasource.password=cali_pass

    Dockerfile: run with profile

    FROM java:8
    WORKDIR /
    ADD target/explorecali-2.0.0-SNAPSHOT.jar //
    EXPOSE 8080
    ENTRYPOINT
    [ "java",
    "-jar",
    "-Dspring.profiles.active=mysql",
    "/explorecali-3.0.0-SNAPSHOT.jar"]

    Build the applciation:

    mvn package -DskipTests=true

    Build the image:

    docker build -t explorecali .

    Link mysql image to application image:

    docker run --name ec-app -p 8080:8080 --link ec-mysql:mysql -d explorecali
  • 相关阅读:
    Linux系统管理上机作业2
    Linux系统管理上机作业1
    作业
    作业
    作业2
    作业
    作业
    第三章
    第二章
    第一章:计算机网络参考模型
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14199363.html
Copyright © 2011-2022 走看看