docker 部署spring boot 应用

2018-06-13  本文已影响524人  小强唐

docker基础配置

示例.png

spring boot 项目配置

            <!--docker 支持-->
            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.4.13</version>
                <configuration>
                    <!--生成的镜像名(不能有大写英文字母)-->
                    <imageName>ramer/${project.artifactId}</imageName>
                    <!--docker 远程访问地址-->
                    <dockerHost>http://47.106.197.89:2375</dockerHost>
                    <dockerDirectory>src/main/docker</dockerDirectory>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
FROM frolvlad/alpine-oraclejdk8
VOLUME /tmp
ADD eureka-0.0.1-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENV JAVA_OPTS=""
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ]

运行docker 镜像

上一篇下一篇

猜你喜欢

热点阅读