无法部署“中心映像id:some”/centre:latest':java.lang.nullpointerexception

fhity93d  于 2021-07-12  发布在  Java
关注(0)|答案(0)|浏览(213)

我使用docker运行我的spring boot应用程序和intellij idea。我可以构建我的应用程序的映像,但是,如果运行映像,我将得到如下消息:

Failed to deploy 'centre Image id: some/centre:latest': java.lang.NullPointerException

几天前,我可以使用相同的操作来运行我的docker映像,它只是一个spring启动应用程序。现在,我使用maven来构建我的项目,因此,单个应用程序是我项目的一个模块,在那之后,我遇到了问题。
我的相关文件如下:
dockerfile文件:

FROM java:8
VOLUME /tmp
ADD study-info-0.0.1-SNAPSHOT.jar app.jar
EXPOSE 80 443
ENTRYPOINT [ "java", "-jar", "/app.jar" ]

pom.xml文件:

<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.some</groupId>
        <artifactId>web-site</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <groupId>com.some</groupId>
    <artifactId>study-info</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>study-info</name>
    <description>study-info</description>
    <properties>
        <java.version>1.8</java.version>
        <skipTests>true</skipTests>
    </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-security</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jdbc</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-freemarker</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>1.0.0</version>
                <executions>
                    <execution>
                        <id>build-image</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <imageName>some/${project.artifactId}</imageName>
                    <imageTags>
                        <imageTag>latest</imageTag>
                    </imageTags>
                    <dockerDirectory>${project.basedir}/src/main/resources/Docker</dockerDirectory>
                    <dockerHost>http://*.*.*.*:2375</dockerHost>
                    <resources>
                        <resource>
                            <targetPath>/</targetPath>
                            <directory>${project.build.directory}</directory>
                            <include>${project.build.finalName}.jar</include>
                        </resource>
                    </resources>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题