Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't clean all dangling images. #1729

Open
lin-mt opened this issue Nov 24, 2023 · 3 comments
Open

Can't clean all dangling images. #1729

lin-mt opened this issue Nov 24, 2023 · 3 comments

Comments

@lin-mt
Copy link

lin-mt commented Nov 24, 2023

Description

if Dockerfile like this, after run docker:build, it can't auto clean all dangling iamges.

FROM ubuntu:22.04  as builder

WORKDIR /application
COPY ./target/application.jar application.jar
RUN java -Djarmode=layertools -jar application.jar extract

FROM ubuntu:22.04
WORKDIR /application
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./
ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"]

Info

  • docker-maven-plugin version : v0.43.4
  • Maven version (mvn -v) :
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546)
Maven home: C:\Users\...
Java version: 17.0.9, vendor: Amazon.com Inc., runtime: C:\Users\...\.jdks\corretto-17.0.9
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"
  • Docker version :
  • If it's a bug, how to reproduce :
  • If it's a feature request, what is your use case :
  • Sample project : [GitHub Clone URL]
    docker -v :
Docker version 24.0.6, build ed223bc
@rohanKanojia
Copy link
Member

@lin-mt : Do you get some error while plugin is building image? Default behavior is to try cleaning up dangling images. Have you specified cleanup configuration option via plugin configuration?

@lin-mt
Copy link
Author

lin-mt commented Nov 27, 2023

@lin-mt : Do you get some error while plugin is building image? Default behavior is to try cleaning up dangling images. Have you specified cleanup configuration option via plugin configuration?

            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.43.4</version>
                <configuration>
                    <images>
                        <image>
                            <name>docker-application:${project.version}</name>
                            <build>
                                <dockerFileDir>${project.basedir}</dockerFileDir>
                            </build>
                        </image>
                        <image>
                            <name>docker-application:latest</name>
                            <build>
                                <dockerFileDir>${project.basedir}</dockerFileDir>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>

this is my config. and I run this task:
image

@lin-mt
Copy link
Author

lin-mt commented Nov 27, 2023

This is log.

[INFO] Scanning for projects...
[INFO] 
[INFO] -----------------< cn.linmt:application-service >------------------
[INFO] Building application-service 1.0.0
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- docker:0.43.4:build (default-cli) @ application-service ---
[INFO] Building tar: C:\Users\linmt\IdeaProjects\application\application-service\target\docker\docker-application\1.0.0\tmp\docker-build.tar
[INFO] DOCKER> [docker-application:1.0.0]: Created docker-build.tar in 2 seconds 
[INFO] DOCKER> [docker-application:1.0.0]: Built image sha256:289c2
[INFO] DOCKER> docker-application:1.0.0: Removed dangling image sha256:d6a3a
[INFO] Building tar: C:\Users\linmt\IdeaProjects\application\application-service\target\docker\docker-application\latest\tmp\docker-build.tar
[INFO] DOCKER> [docker-application:latest]: Created docker-build.tar in 1 second 
[INFO] DOCKER> [docker-application:latest]: Built image sha256:289c2
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  28.682 s
[INFO] Finished at: 2023-11-27T09:20:39+08:00
[INFO] ------------------------------------------------------------------------
[WARNING] 
[WARNING] Plugin validation issues were detected in 1 plugin(s)
[WARNING] 
[WARNING]  * io.fabric8:docker-maven-plugin:0.43.4
[WARNING] 
[WARNING] For more or less details, use 'maven.plugin.validation' property with one of the values (case insensitive): [BRIEF, DEFAULT, VERBOSE]
[WARNING] 

Process finished with exit code 0

It doesn't seem to remove dangling image with the latest tag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants