Ford O.
Ford O.

Reputation: 1498

No such file or directory, when building scala docker image

I have auto generated the following docker file with sbt for my scala project:

FROM robsonoduarte/8-jre-alpine-bash:latest
WORKDIR /opt/docker
ADD opt /opt
RUN ["chown", "-R", "daemon:daemon", "."]
EXPOSE 6999
USER daemon
ENTRYPOINT ["bin/app"]
CMD []

Yet when I run build . -t app I get the following error:

Sending build context to Docker daemon  166.2MB
Step 1/7 : FROM robsonoduarte/8-jre-alpine-bash:latest
 ---> 9bbc00a23a9b
Step 2/7 : WORKDIR /opt/docker
Removing intermediate container 817f86d4a46e
 ---> b648d213f308
Step 3/7 : ADD opt /opt
ADD failed: stat /var/lib/docker/tmp/docker-builder679116314/opt: no such file or directory

I have tried to reinstall docker as suggested in another SO answer, but that did not help. I am also using windows, and I cannot find the /var/lib folder.

Upvotes: 1

Views: 777

Answers (1)

Tom Rijntjes
Tom Rijntjes

Reputation: 654

The ADD command copies files from <src> to <dest>. In your case, Docker expects a folder called 'opt' from the location where you run build . -t app. Does such a folder exist?

Upvotes: 2

Related Questions