Unable to access application inside the container when building image using maven plugin

18 Views Asked by At

This is the maven plugin I use, I am trying to expose port so I can access the localhost url outside the container

<build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>build-image</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <image>
                        <name>restaurant-image</name>
                    </image>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                    <layers>
                        <enabled>true</enabled>
                    </layers>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
            </plugin>
        </plugins>
    </build>

Image is getting build and before I run the image in the docker desktop, this is what I see:

enter image description here

Not sure how to configure that port or if the we need to configure the port to hit localhost and test the application in the container.

0

There are 0 best solutions below