question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

A tar file cannot include itself

See original GitHub issue

Here’s my project structure

/base$ ls -al
total 32
drwxrwxr-x  4 arthur arthur 4096 Feb 25 10:46 .
drwxrwxr-x 17 arthur arthur 4096 Feb 24 16:07 ..
-rw-rw-r--  1 arthur arthur  752 Feb 25 10:46 Dockerfile
drwxrwxr-x  8 arthur arthur 4096 Feb 25 10:46 .git
-rw-rw-r--  1 arthur arthur    8 Jan 22 15:00 .gitignore
-rw-rw-r--  1 arthur arthur 1924 Feb 25 10:46 pom.xml
-rw-rw-r--  1 arthur arthur   53 Jan 22 15:00 Readme.md
drwxrwxr-x  4 arthur arthur 4096 Feb 25 10:39 target

and the pom file has

            <plugin>
                <groupId>io.fabio8</groupId>
                <artifactId>docker-maven-plugin</artifactId>
                <version>0.14.0</version>
                <configuration>
                    <registry>myregistry.com</registry>
                    <images>
                        <image>
                            <alias>base</alias>
                            <name>base:${project.version}</name>
                            <build>
                                <assembly>
                                    <dockerFileDir>${project.basedir}</dockerFileDir>
                                </assembly>
                            </build>
                        </image>
                    </images>
                </configuration>
                <executions>
                    <execution>
                        <id>docker</id>
                        <phase>package</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>registry</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

the same setup works in 0.13.9 but get this starting 0.14.0

[ERROR] Failed to execute goal io.fabric8:docker-maven-plugin:0.14.0:build (docker) on project nodejs: Execution docker of goal io.fabric8:docker-maven-plugin:0.14.0:build failed: A tar file cannot include itself. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.fabric8:docker-maven-plugin:0.14.0:build (docker) on project nodejs: Execution docker of goal io.fabric8:docker-maven-plugin:0.14.0:build failed: A tar file cannot include itself.

thanks.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13

github_iconTop GitHub Comments

22reactions
rhusscommented, Feb 25, 2016

Sorry, forgot that there is already support for a .maven-dockerignore which can contain ant style patterns for excluding directories.

So adding a .maven-dockerignore with the content

target/**

will avoid the inclusion of the target directory.

Does this work for you ?

11reactions
arthurtsangcommented, Feb 26, 2016

it works! thanks. btw, target/docker/** works too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix - Execution build and start of goal io.fabric8:docker ...
How to fix- Execution build and start of goal io.fabric8:docker-maven-plugin:0.20.0:build failed: A tar file cannot include itself.
Read more >
Error creating assembly archive null: A tar file cannot include ...
I looked at this question How to prevent 'Error creating assembly archive distribution: A zip file cannot include itself' that's similar and I...
Read more >
Build Docker Images with Maven and Gradle
... because this plugin uses target/docker to generate the build and if you try to build it you'll get next exception: tar file...
Read more >
Tar: How to ignore the archive itself - backup - Super User
Try tar cvfz backup.tar.gz *. This way shell extends the *, vs the tar reading current directory. The difference is that the produced ......
Read more >
The Destination Directory Cannot Include Itself - ADocLib
A tar file cannot include itself #397 The reason could be the update of the Maven assembly plugin to the newest version 2.6...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found