我正在尝试为我的spring-boot应用程序构建一个docker映像。这是我的DockerFile:
FROM ubuntu
ENV JAVA_VERSION 8u31
ENV BUILD_VERSION b13
# Upgrading system
RUN apt-get -y upgrade
RUN apt-get -y install wget
# Downloading & Config Java 8
RUN wget --no-cookies --no-check-certificate --header "Cookie:
oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-
pub/java/jdk/$JAVA_VERSION-$BUILD_VERSION/jdk-$JAVA_VERSION-linux-
x64.rpm" -O /tmp/jdk-8-linux-x64.rpm
RUN apt-get -y install /tmp/jdk-8-linux-x64.rpm
RUN alternatives -- install /usr/lib/jvm/java-8-oracle/jre/bin/java
1081
RUN alternatives --install /usr/lib/jvm/java-8-openjdk-
amd64/jre/bin/java 1081
RUN alternatives --install /usr/lib/jvm/java-8-oracle/jre/bin/java
1081
EXPOSE 8089
#install Spring Boot artifact
VOLUME /tmp
ADD /maven/sfg-thymeleaf-course-0.0.1-SNAPSHOT.jar sfg-thymeleaf-
course.jar
RUN sh -c 'touch /sfg-thymeleaf-course.jar'
ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom","-
jar","/sfg-thymeleaf-course.jar"]
这是我的pom.xml文件,其中有我的io.fabric8插件:
`<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.uipurpose</groupId>
<artifactId>detailsapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>detailsapp</name>
<description>Demo project for integrating with Angular</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>com.microsoft.sqlserver</groupId>-->
<!--<artifactId>mssql-jdbc</artifactId>-->
<!--<scope>runtime</scope>-->
<!--</dependency>-->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.15.3</version>
<configuration>
<dockerHost>http://127.0.0.1:2375</dockerHost>
<verbose>true</verbose>
<images>
<image>
<name>nisharunnisa/sample-spring-boot-app</name>
<build>
<dockerFile>Dockerfile</dockerFile>
<assembly>
<descriptorRef>artifact</descriptorRef>
</assembly>
</build>
</image>
</images>
</configuration>
</plugin>
</plugins>
</build>
</project>`.
当我试图使用MVN包docker:build
构建docker映像时,我得到一个错误:
无法执行目标IO.fabric8:docker-maven-plugin:0.15.3:在项目详细信息上生成(default-cli)app:执行目标IO.fabric8:docker-maven-plugin:0.15.3:生成失败。NullPointerException->[帮助1]
这对我来说是可行的,为了构建docker映像并将其推送到docker hub,我不使用docker文件,而是由fabric创建:
mvn clean install fabric8:build fabric8:push
我的pom是这样的:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gregclinker</groupId>
<artifactId>boot-docker</artifactId>
<version>1.0.4</version>
<packaging>jar</packaging>
<name>Boot Docker</name>
<description>Spring Boot and Docker</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.RELEASE</version>
<relativePath />
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>3.5.41</version>
</plugin>
</plugins>
</build>
</project>
我正在使用docker-maven-plugin为Java微服务创建一个dockerfile和docker映像。当我运行命令时,它不会创建DockerFile。 下面是pom.xml中构建任务的配置: 没有错误消息,但没有dockefile。下面是我运行时向屏幕发出的消息:
[错误]D:...\spark-test\java-gett-start\src\main\java\main.java:[73,35]错误:源代码1.5中不支持lambda表达式 这是一个heroku示例java项目,在System.properties文件中设置了java版本:java.runtime.version=1.8 具体行如下:
docker maven plugin 是个简单的可以管理Docker容器maven插件,这个插件将会根据你的配置,在构建时启动容器,构建结束时停止容器并删除,如果本地找不到镜像,Docker会自动去中央仓库下载。 简单示例: <plugin> <groupId>com.ofbizian</groupId> <artifactId>docker-maven-plugin</artifa
----maven-enforcer-plugin:1.0.1:enforce(default)@cli---添加ignore:org.eclipse.jetty.spdy.* ----maven-enforcer-plugin:1.0.1:enforce(enforce-bang-dependencies)@cli-- ---build-helper-maven-plugin:1.7:times
我正在TFS2015中运行一个构建,我得到了这个错误: 在org.apache.maven.lifecycle.internal.mojoexecutor.execute(mojoexecutor.java:217) 原因:org.apache.maven.plugin.MojoExecutionException:编译时出现致命错误 222 2018-07-25T11:22:37.0150577
Docker Compose Maven Plugin Quickstart Available on Maven Central. <dependency> <groupId>com.dkanejs.maven.plugins</groupId> <artifactId>docker-compose-maven-plugin</artifactId> <version>$VER