Table of Contents
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.
When using fabric8:docker-maven-plugin I got this error and below fix helped me to fix this.
I assume this error occurs when you use dockerFileDir or dockerFile tag in maven plugin, it seems the tar file which is generated inside /target/docker/tmp/ is trying to include itself to create a docker image
The easiest fix for this problem is to create a file named .maven-dockerignore , this file is used for excluding files from builds
So adding a file .maven-dockerignore with the content
will avoid adding the target directory when creating a docker image
You can keep this file at Project root level like .gitignore, .dockerignore