Tag Archives: Intellj Building image Error: ADD failed: no source files were specified

[Solved] Intellj Building image Error: ADD failed: no source files were specified

Building image in IntelliJ…

Deploying ‘boot-docker-demo Dockerfile: docker/Dockerfile’…
Building image…
Step 1/5 : FROM java:8

—> d23bdf5b1b1b

Step 2/5 : VOLUME /tmp

—> Using cache

—> e093c2ceecef

Step 3/5 : ADD *.jar.jar boot-docker-demo.jar

Error: ResponseItem.ErrorDetail[code=<null>,message=ADD failed: no source files were specified]
Failed to deploy ‘boot-docker-demo Dockerfile: docker/Dockerfile’: ADD failed: no source files were specified

Solution:

The jar path is not specified correctly in Dockfile.

Note the command: COPY is used to copy local files or folders to the mirror path, e.g.

COPY target/*.jar boot-docker-demo.jar

ADD can download content from a URL address to copy to the container, e.g.

ADD last.tar.gz /var/www

Note: You cannot ADD files outside of the build directory or below, e.g. : . /path

So for copying files only, it is recommended to use _COPY