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

Problem writing in xAR operation; archives contains unclosed entries #171

Closed
sverhagen opened this Issue May 17, 2015 · 25 comments

Comments

Projects
None yet
7 participants
@sverhagen
Contributor

sverhagen commented May 17, 2015

As of 0.11.4 we are seeing the following problem:

[INFO] --- docker-maven-plugin:0.11.4:build (dockerize) @ myProject ---
[INFO] DOCKER> Creating image [myCompany/myProject:0.1.0-SNAPSHOT] "myProject"
[INFO] Reading assembly descriptor: E:\myProject\src\build\docker\assembly.xml
[INFO] Building tar: E:\myProject\target\docker\myCompany\myProject\0.1.0-SNAPSHOT\build\maven.tgz
[WARNING] When creating tar entry
org.codehaus.plexus.archiver.ArchiverException: Problem writing to output in xAR operation request to write '732' bytes exceeds size in header of '488' bytes for entry './usr/local/tomcat/webapps/myWebapp/META-INF/MANIFEST.MF'
        at org.codehaus.plexus.archiver.util.Streams.copyFullyDontCloseOutput(Streams.java:122)
        at org.codehaus.plexus.archiver.tar.TarArchiver.tarFile(TarArchiver.java:335)
        at org.codehaus.plexus.archiver.tar.TarArchiver.execute(TarArchiver.java:188)
        at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:930)
        at org.apache.maven.plugin.assembly.archive.archiver.AssemblyProxyArchiver.createArchive(AssemblyProxyArchiver.java:589)
        at org.apache.maven.plugin.assembly.archive.DefaultAssemblyArchiver.createArchive(DefaultAssemblyArchiver.java:165)
        at org.jolokia.docker.maven.assembly.DockerAssemblyManager.createAssemblyTarArchive(DockerAssemblyManager.java:177)
        at org.jolokia.docker.maven.assembly.DockerAssemblyManager.createDockerTarArchive(DockerAssemblyManager.java:69)
        at org.jolokia.docker.maven.BuildMojo.buildImage(BuildMojo.java:82)
        at org.jolokia.docker.maven.BuildMojo.executeInternal(BuildMojo.java:64)
        at org.jolokia.docker.maven.AbstractDockerMojo.execute(AbstractDockerMojo.java:134)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

And:

[ERROR] Failed to execute goal org.jolokia:docker-maven-plugin:0.11.4:build (dockerize) on project myProject: Failed to create assembly for docker image: Error creating assembly archive docker: This archives contains unclosed entries. -> [Help 1]

Plugin execution as configured in pom.xml:

<plugin>
    <groupId>org.jolokia</groupId>
    <artifactId>docker-maven-plugin</artifactId>
    <version>0.11.4</version> <!-- NO PROBLEM WITH 0.11.3 -->
    <executions>
        <execution>
            <id>dockerize</id>
            <phase>package</phase>
            <goals>
                <goal>build</goal>
            </goals>
            <configuration>
                <images>
                    <image>
                        <name>myCompany/${project.artifactId}:${project.version}</name>
                        <alias>${project.artifactId}</alias>
                        <build>
                            <from>registry.hub.docker.com/tomcat:7-jre8</from>
                            <ports>
                                <port>8080</port>
                            </ports>
                            <assembly>
                                <basedir>/</basedir>
                                <descriptor>${basedir}/src/build/docker/assembly.xml</descriptor>
                            </assembly>
                        </build>
                    </image>
                </images>
                <registry>my company's registry</registry>
            </configuration>
        </execution>
    </executions>
</plugin>

Assembly as defined in ${basedir}/src/build/docker/assembly.xml:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
    <id>redacted</id>
    <dependencySets>
        <dependencySet>
            <includes>
                <include>${project.groupId}:${project.artifactId}</include>
            </includes>
            <outputDirectory>/usr/local/tomcat/webapps/myWebapp</outputDirectory>
            <unpack>true</unpack>
            <useProjectArtifact>true</useProjectArtifact>
        </dependencySet>
    </dependencySets>
    <files>
        <file>
            <outputDirectory>/usr/local/tomcat/conf</outputDirectory>
            <source>${basedir}/src/build/docker/context.xml</source>
        </file>
    </files>
</assembly>

This defect may have been introduced by issue #139, although that's just a hunch.

rhuss added a commit that referenced this issue May 17, 2015

@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss May 17, 2015

Collaborator

Yes, thats true. I changed it a bit to use tar instead of tgz as intermediate format and pushed a 0.11.5-SNAPSHOT to Maven central.

Alternatively you can get this change via branch integration.

Does this help ? (hadn't a chance yet to repdroduce it myself)

Collaborator

rhuss commented May 17, 2015

Yes, thats true. I changed it a bit to use tar instead of tgz as intermediate format and pushed a 0.11.5-SNAPSHOT to Maven central.

Alternatively you can get this change via branch integration.

Does this help ? (hadn't a chance yet to repdroduce it myself)

@sverhagen

This comment has been minimized.

Show comment
Hide comment
@sverhagen

sverhagen May 18, 2015

Contributor

Thank you for that. I tried a 0.11.5-SNAPSHOT with the following SHA1: f9575b034d576b94194e7814cfb5af8f119b0b19, and it did not resolve my problem. It did not change any of the above behavior.

Contributor

sverhagen commented May 18, 2015

Thank you for that. I tried a 0.11.5-SNAPSHOT with the following SHA1: f9575b034d576b94194e7814cfb5af8f119b0b19, and it did not resolve my problem. It did not change any of the above behavior.

@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss May 18, 2015

Collaborator

Ok. May I ask to try a third time ? Now I changed from using tar to zip. I just pushed the corresponding snapshot (sha1: 3f81bca7d349af3a6d0c597816b8ce702afbfe3e)

Sorry, but I guess the issue is also connected to the OS (Windows in your case if I'm right) and I don't have a Windows setup (yet).

If this doesn't help, I will try to reproduce the issue so that I can better debug it.

Thanks for your patience ...

Collaborator

rhuss commented May 18, 2015

Ok. May I ask to try a third time ? Now I changed from using tar to zip. I just pushed the corresponding snapshot (sha1: 3f81bca7d349af3a6d0c597816b8ce702afbfe3e)

Sorry, but I guess the issue is also connected to the OS (Windows in your case if I'm right) and I don't have a Windows setup (yet).

If this doesn't help, I will try to reproduce the issue so that I can better debug it.

Thanks for your patience ...

@sverhagen

This comment has been minimized.

Show comment
Hide comment
@sverhagen

sverhagen May 18, 2015

Contributor

Thank you for that. The issue was not limited to Windows, Mac users have seen this happening. I don't think I've seen it happening on any of our CI servers, which are Linux.

I tried the new 0.11.5-SNAPSHOT and it does fix the problem. It seems to create ZIP and a TAR, for what it's worth.

[INFO] --- docker-maven-plugin:0.11.4:build (dockerize) @ myProject ---
[INFO] DOCKER> Creating image [myCompany/myProject:0.1.0-SNAPSHOT] "myProject"
[INFO] Reading assembly descriptor: E:\myProject\src\build\docker\assembly.xml
[INFO] Building zip: E:\myProject\target\docker\myCompany\myProject\0.1.0-SNAPSHOT\build\maven.zip
[INFO] Building tar: E:\myProject\target\docker\myCompany\myProject\0.1.0-SNAPSHOT\tmp\docker-build.tar

It would be great to get this in a released version!

Contributor

sverhagen commented May 18, 2015

Thank you for that. The issue was not limited to Windows, Mac users have seen this happening. I don't think I've seen it happening on any of our CI servers, which are Linux.

I tried the new 0.11.5-SNAPSHOT and it does fix the problem. It seems to create ZIP and a TAR, for what it's worth.

[INFO] --- docker-maven-plugin:0.11.4:build (dockerize) @ myProject ---
[INFO] DOCKER> Creating image [myCompany/myProject:0.1.0-SNAPSHOT] "myProject"
[INFO] Reading assembly descriptor: E:\myProject\src\build\docker\assembly.xml
[INFO] Building zip: E:\myProject\target\docker\myCompany\myProject\0.1.0-SNAPSHOT\build\maven.zip
[INFO] Building tar: E:\myProject\target\docker\myCompany\myProject\0.1.0-SNAPSHOT\tmp\docker-build.tar

It would be great to get this in a released version!

@sverhagen

This comment has been minimized.

Show comment
Hide comment
@sverhagen

sverhagen May 18, 2015

Contributor

I also just noticed that at the end of the build, there's a message now:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:55 min
[INFO] Finished at: 2015-05-17T23:33:36-07:00
[INFO] Final Memory: 125M/588M
[INFO] ------------------------------------------------------------------------
Cleaning up unclosed ZipFile for archive E:\myProject\target\docker\myCompany\myProject\0.1.0-SNAPSHOT\build\maven.zip
Contributor

sverhagen commented May 18, 2015

I also just noticed that at the end of the build, there's a message now:

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:55 min
[INFO] Finished at: 2015-05-17T23:33:36-07:00
[INFO] Final Memory: 125M/588M
[INFO] ------------------------------------------------------------------------
Cleaning up unclosed ZipFile for archive E:\myProject\target\docker\myCompany\myProject\0.1.0-SNAPSHOT\build\maven.zip
@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss May 18, 2015

Collaborator

Thanks, for confirming that it works. I indeed make this configurable, so that you can even use the "old" variant without an intermediate archive (but by copying directories). The advantage of using an archive is that file permissions should be better preserved because they are then independent on the underlying filesystem (that's the theory :).

I will also take care of cleaning up the zip-file. fwiw, I plan a 0.11.5 release this week with this fix + fixed registry handling.

Collaborator

rhuss commented May 18, 2015

Thanks, for confirming that it works. I indeed make this configurable, so that you can even use the "old" variant without an intermediate archive (but by copying directories). The advantage of using an archive is that file permissions should be better preserved because they are then independent on the underlying filesystem (that's the theory :).

I will also take care of cleaning up the zip-file. fwiw, I plan a 0.11.5 release this week with this fix + fixed registry handling.

@sverhagen

This comment has been minimized.

Show comment
Hide comment
@sverhagen

sverhagen May 18, 2015

Contributor

Sounds good, a release this week, particularly if that were to include more goodies that I look forward to 😄 (#146?)

Contributor

sverhagen commented May 18, 2015

Sounds good, a release this week, particularly if that were to include more goodies that I look forward to 😄 (#146?)

@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss May 18, 2015

Collaborator

#146 is already fixed (but not yet pushed, need some better testing yet)

Collaborator

rhuss commented May 18, 2015

#146 is already fixed (but not yet pushed, need some better testing yet)

@rhuss rhuss added this to the 0.11.5 milestone May 18, 2015

@rhuss rhuss added the bug label May 18, 2015

@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss May 18, 2015

Collaborator

The zip file issue is probably due to this bug: https://jira.codehaus.org/browse/MASSEMBLY-742 We probably have to wait until this is fixed.

Collaborator

rhuss commented May 18, 2015

The zip file issue is probably due to this bug: https://jira.codehaus.org/browse/MASSEMBLY-742 We probably have to wait until this is fixed.

rhuss added a commit that referenced this issue May 18, 2015

Make assembly file container format configurable
This can be specified with <build><assembly><mode>...</....> where
mode can be "dir", "tar", "tgz" or "zip". Fixes #171.

Still todo: Allow configuraton over property, too.

@rhuss rhuss closed this in df05114 May 18, 2015

@dverbeek84

This comment has been minimized.

Show comment
Hide comment
@dverbeek84

dverbeek84 Jul 8, 2015

@rhuss can you update maven-assambly-plugin? white 2.5.3 i don't get the stacktrace but a error message. Now it is saying A tar file cannot include itself. This is because i am using the project root folder. @sverhagen is this also your problem?

dverbeek84 commented Jul 8, 2015

@rhuss can you update maven-assambly-plugin? white 2.5.3 i don't get the stacktrace but a error message. Now it is saying A tar file cannot include itself. This is because i am using the project root folder. @sverhagen is this also your problem?

@arthurtsang

This comment has been minimized.

Show comment
Hide comment
@arthurtsang

arthurtsang Feb 25, 2016

@rhuss i'm using 0.14.1 and have the same issue as @dverbeek84. the same setup works in 0.13.9 (having the Dockerfile in the project root. looks like it's tar-ing up target while writing it's output under target?

arthurtsang commented Feb 25, 2016

@rhuss i'm using 0.14.1 and have the same issue as @dverbeek84. the same setup works in 0.13.9 (having the Dockerfile in the project root. looks like it's tar-ing up target while writing it's output under target?

@vrenjith

This comment has been minimized.

Show comment
Hide comment
@vrenjith

vrenjith May 30, 2016

Roland,

Do you why this issue is happening again? I am using 0.14.0.

<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.14.0</version>
[WARNING] When creating tar entry
org.codehaus.plexus.archiver.ArchiverException: Problem writing to output in xAR operation request to write '8192' bytes exceeds size in header of '755826688' bytes for entry 'target/docker/registry.mo.test/5002/sampleapp/service/tmp/docker-build.tar'
    at org.codehaus.plexus.archiver.util.Streams.copyFullyDontCloseOutput(Streams.java:122)
    at org.codehaus.plexus.archiver.tar.TarArchiver.tarFile(TarArchiver.java:318)
    at org.codehaus.plexus.archiver.tar.TarArchiver.execute(TarArchiver.java:171)
    at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:916)
    at io.fabric8.maven.docker.assembly.DockerAssemblyManager.createBuildTarBall(DockerAssemblyManager.java:183)
    at io.fabric8.maven.docker.assembly.DockerAssemblyManager.createDockerTarArchive(DockerAssemblyManager.java:93)
    at io.fabric8.maven.docker.service.ArchiveService.createArchive(ArchiveService.java:102)
    at io.fabric8.maven.docker.service.BuildService.buildImage(BuildService.java:48)
    at io.fabric8.maven.docker.AbstractBuildSupportMojo.buildImage(AbstractBuildSupportMojo.java:63)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag(BuildMojo.java:46)
    at io.fabric8.maven.docker.BuildMojo.executeInternal(BuildMojo.java:38)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:164)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)

vrenjith commented May 30, 2016

Roland,

Do you why this issue is happening again? I am using 0.14.0.

<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.14.0</version>
[WARNING] When creating tar entry
org.codehaus.plexus.archiver.ArchiverException: Problem writing to output in xAR operation request to write '8192' bytes exceeds size in header of '755826688' bytes for entry 'target/docker/registry.mo.test/5002/sampleapp/service/tmp/docker-build.tar'
    at org.codehaus.plexus.archiver.util.Streams.copyFullyDontCloseOutput(Streams.java:122)
    at org.codehaus.plexus.archiver.tar.TarArchiver.tarFile(TarArchiver.java:318)
    at org.codehaus.plexus.archiver.tar.TarArchiver.execute(TarArchiver.java:171)
    at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:916)
    at io.fabric8.maven.docker.assembly.DockerAssemblyManager.createBuildTarBall(DockerAssemblyManager.java:183)
    at io.fabric8.maven.docker.assembly.DockerAssemblyManager.createDockerTarArchive(DockerAssemblyManager.java:93)
    at io.fabric8.maven.docker.service.ArchiveService.createArchive(ArchiveService.java:102)
    at io.fabric8.maven.docker.service.BuildService.buildImage(BuildService.java:48)
    at io.fabric8.maven.docker.AbstractBuildSupportMojo.buildImage(AbstractBuildSupportMojo.java:63)
    at io.fabric8.maven.docker.BuildMojo.buildAndTag(BuildMojo.java:46)
    at io.fabric8.maven.docker.BuildMojo.executeInternal(BuildMojo.java:38)
    at io.fabric8.maven.docker.AbstractDockerMojo.execute(AbstractDockerMojo.java:164)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss May 30, 2016

Collaborator

@vrenjith could you update to d-m-p 0.15.3 (which is the latest version) ? If the problem then still persists, could you please post your build condiguration ?

thanks ...

Collaborator

rhuss commented May 30, 2016

@vrenjith could you update to d-m-p 0.15.3 (which is the latest version) ? If the problem then still persists, could you please post your build condiguration ?

thanks ...

@vrenjith

This comment has been minimized.

Show comment
Hide comment
@vrenjith

vrenjith May 30, 2016

Unfortunately it still fails with 0.15.3

[INFO] Building tar: /home/vagrant/SampleApp/greeting-service/target/docker/registry.mo.sap.corp/5002/ariba-sampleapp/greeting-service/tmp/docker-build.tar
[WARNING] When creating tar entry
org.codehaus.plexus.archiver.ArchiverException: Problem writing to output in xAR operation request to write '8192' bytes exceeds size in header of '755826688' bytes for entry 'target/docker/registry.mo.sap.corp/5002/ariba-sampleapp/greeting-service/tmp/docker-build.tar'
    at org.codehaus.plexus.archiver.util.Streams.copyFullyDontCloseOutput(Streams.java:122)
    at org.codehaus.plexus.archiver.tar.TarArchiver.tarFile(TarArchiver.java:318)
    at org.codehaus.plexus.archiver.tar.TarArchiver.execute(TarArchiver.java:171)
    at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:916)
    at io.fabric8.maven.docker.assembly.DockerAssemblyManager.createBuildTarBall(DockerAssemblyManager.java:188)
    at io.fabric8.maven.docker.assembly.DockerAssemblyManager.createDockerTarArchive(DockerAssemblyManager.java:113)

vrenjith commented May 30, 2016

Unfortunately it still fails with 0.15.3

[INFO] Building tar: /home/vagrant/SampleApp/greeting-service/target/docker/registry.mo.sap.corp/5002/ariba-sampleapp/greeting-service/tmp/docker-build.tar
[WARNING] When creating tar entry
org.codehaus.plexus.archiver.ArchiverException: Problem writing to output in xAR operation request to write '8192' bytes exceeds size in header of '755826688' bytes for entry 'target/docker/registry.mo.sap.corp/5002/ariba-sampleapp/greeting-service/tmp/docker-build.tar'
    at org.codehaus.plexus.archiver.util.Streams.copyFullyDontCloseOutput(Streams.java:122)
    at org.codehaus.plexus.archiver.tar.TarArchiver.tarFile(TarArchiver.java:318)
    at org.codehaus.plexus.archiver.tar.TarArchiver.execute(TarArchiver.java:171)
    at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:916)
    at io.fabric8.maven.docker.assembly.DockerAssemblyManager.createBuildTarBall(DockerAssemblyManager.java:188)
    at io.fabric8.maven.docker.assembly.DockerAssemblyManager.createDockerTarArchive(DockerAssemblyManager.java:113)
@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss May 30, 2016

Collaborator

Can you please post your configuration ?

Collaborator

rhuss commented May 30, 2016

Can you please post your configuration ?

@vrenjith

This comment has been minimized.

Show comment
Hide comment
@vrenjith

vrenjith May 30, 2016

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <!-- <executable>true</executable> -->
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.15.3</version>
                <configuration>
                    <images>
                        <image>
                            <alias>greeting-service-${maven.build.timestamp}</alias>
                            <name>${localregistry}/${docker.image.prefix}/greeting-service</name>
                            <build>
                                <assembly>
                                    <descriptorRef>artifact</descriptorRef>
                                    <dockerFileDir>${project.basedir}/.</dockerFileDir>
                                </assembly>
                            </build>
                            <run>
                                <namingStrategy>alias</namingStrategy>
                                                                <envPropertyFile>/home/vagrant/SampleApp/cobalt/LocalEnv</envPropertyFile>
                                <net>pod-network</net>
                                <ports>
                                    <port>8000:8080</port>
                                </ports>
                            </run>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>build</goal>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

vrenjith commented May 30, 2016

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                    <!-- <executable>true</executable> -->
                </configuration>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.15.3</version>
                <configuration>
                    <images>
                        <image>
                            <alias>greeting-service-${maven.build.timestamp}</alias>
                            <name>${localregistry}/${docker.image.prefix}/greeting-service</name>
                            <build>
                                <assembly>
                                    <descriptorRef>artifact</descriptorRef>
                                    <dockerFileDir>${project.basedir}/.</dockerFileDir>
                                </assembly>
                            </build>
                            <run>
                                <namingStrategy>alias</namingStrategy>
                                                                <envPropertyFile>/home/vagrant/SampleApp/cobalt/LocalEnv</envPropertyFile>
                                <net>pod-network</net>
                                <ports>
                                    <port>8000:8080</port>
                                </ports>
                            </run>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>build</goal>
                            <goal>start</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>stop</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss May 30, 2016

Collaborator

@vrenjith first of all, it doesn't make sense to use both, dockerFileDir and descriptorRef, since these are different methods for creating docker images.

Then if, you use basedir as the place for the Dockerfile, you also include the target/ directory in the docker build context. That is what ends up in a docker tar archive, so the archive itself is put into this context.

The solution is to either move your Dockerfile in a separate directory (e.g. src/docker) or you add a file .maven-dockerignore including target/**. See also #397.

Does this help ?

Collaborator

rhuss commented May 30, 2016

@vrenjith first of all, it doesn't make sense to use both, dockerFileDir and descriptorRef, since these are different methods for creating docker images.

Then if, you use basedir as the place for the Dockerfile, you also include the target/ directory in the docker build context. That is what ends up in a docker tar archive, so the archive itself is put into this context.

The solution is to either move your Dockerfile in a separate directory (e.g. src/docker) or you add a file .maven-dockerignore including target/**. See also #397.

Does this help ?

@jessezhao2017

This comment has been minimized.

Show comment
Hide comment
@jessezhao2017

jessezhao2017 Apr 18, 2017

i felt this was terribly documented.

can you guys provide a complete good example?

I tried more than ~30 minutes and no luck to get it working with an external docker file.

jessezhao2017 commented Apr 18, 2017

i felt this was terribly documented.

can you guys provide a complete good example?

I tried more than ~30 minutes and no luck to get it working with an external docker file.

@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss Apr 18, 2017

Collaborator

@jessezhao2017 Thanks for your feedback, I will add some info to the documentation to https://dmp.fabric8.io/#docker:build BTW, if you have some specific comments what is not understandable or missing, I'm happy about any feedback (or even a PR, you find the documentation below src/main/asciidoc.

But in the meantime, maybe you describe your use case and what you want to achieve ? If its only about adding a Dockerfile build, just use

...
<configuration>
  <images>
     <image>
       <build>
         <dockerFileDir>src/main/docker</dockerFileDir>
       </build>
        ...
     <image>
      ....
  </images>
  ....
</configuration>

but this example is also given in the documentation referenced above, so I guess you miss something here. Can you please elaborate a bit what do you miss ? Thanks !

Collaborator

rhuss commented Apr 18, 2017

@jessezhao2017 Thanks for your feedback, I will add some info to the documentation to https://dmp.fabric8.io/#docker:build BTW, if you have some specific comments what is not understandable or missing, I'm happy about any feedback (or even a PR, you find the documentation below src/main/asciidoc.

But in the meantime, maybe you describe your use case and what you want to achieve ? If its only about adding a Dockerfile build, just use

...
<configuration>
  <images>
     <image>
       <build>
         <dockerFileDir>src/main/docker</dockerFileDir>
       </build>
        ...
     <image>
      ....
  </images>
  ....
</configuration>

but this example is also given in the documentation referenced above, so I guess you miss something here. Can you please elaborate a bit what do you miss ? Thanks !

@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss Apr 18, 2017

Collaborator

@jessezhao2017 As promised I added a dedicated example to https://github.com/fabric8io/docker-maven-plugin/tree/master/samples/dockerfile

Please feel free to give any feedback (btw, we also like positive feedback. just in case ;-), and open a new issue if you have problems with the Dockerfile mode or with the documentation.

Collaborator

rhuss commented Apr 18, 2017

@jessezhao2017 As promised I added a dedicated example to https://github.com/fabric8io/docker-maven-plugin/tree/master/samples/dockerfile

Please feel free to give any feedback (btw, we also like positive feedback. just in case ;-), and open a new issue if you have problems with the Dockerfile mode or with the documentation.

@jessezhao2017

This comment has been minimized.

Show comment
Hide comment
@jessezhao2017

jessezhao2017 Apr 18, 2017

jessezhao2017 commented Apr 18, 2017

@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss Apr 18, 2017

Collaborator
Collaborator

rhuss commented Apr 18, 2017

@jessezhao2017

This comment has been minimized.

Show comment
Hide comment
@jessezhao2017

jessezhao2017 Apr 18, 2017

jessezhao2017 commented Apr 18, 2017

@rhuss

This comment has been minimized.

Show comment
Hide comment
@rhuss

rhuss Apr 18, 2017

Collaborator
Collaborator

rhuss commented Apr 18, 2017

@KIC

This comment has been minimized.

Show comment
Hide comment
@KIC

KIC Jun 19, 2017

I run into the same problem:

[WARNING] When creating tar entry
org.codehaus.plexus.archiver.ArchiverException: Problem writing to output in xAR operation request to write '8192' bytes exceeds size in header of '131072' bytes for entry 'target/docker/loader/tmp/docker-build.tar'

using this configuration:

             <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <sourceDirectory>./</sourceDirectory>
                    <dockerHost>tcp://192.168.x.y:2375</dockerHost>
                    <registry>http://192.168.x.y:5000</registry>
                    <useColor>true</useColor>
                    <verbose>true</verbose>
                    <images>
                        <image>
                            <name>app</name>
                            <alias>app</alias>
                            <registry>http://192.168.x.y:5000</registry>
                            <build>
                                <dockerFile>Dockerfile</dockerFile>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>

Note that I am copying the assembly along other stuff in a Dockerfile.

KIC commented Jun 19, 2017

I run into the same problem:

[WARNING] When creating tar entry
org.codehaus.plexus.archiver.ArchiverException: Problem writing to output in xAR operation request to write '8192' bytes exceeds size in header of '131072' bytes for entry 'target/docker/loader/tmp/docker-build.tar'

using this configuration:

             <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <sourceDirectory>./</sourceDirectory>
                    <dockerHost>tcp://192.168.x.y:2375</dockerHost>
                    <registry>http://192.168.x.y:5000</registry>
                    <useColor>true</useColor>
                    <verbose>true</verbose>
                    <images>
                        <image>
                            <name>app</name>
                            <alias>app</alias>
                            <registry>http://192.168.x.y:5000</registry>
                            <build>
                                <dockerFile>Dockerfile</dockerFile>
                            </build>
                        </image>
                    </images>
                </configuration>
            </plugin>

Note that I am copying the assembly along other stuff in a Dockerfile.

leusonmario pushed a commit to leusonmario/docker-maven-plugin that referenced this issue Aug 18, 2018

Update README.md for issue #171
add that you need to use the -DpushImage flag on docker:tag for a private registry as docker:push will use the original image. (issue #171)

leusonmario pushed a commit to leusonmario/docker-maven-plugin that referenced this issue Aug 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment