I have the simplest hello world Java application. Its filesystem:
|-- HelloWorld |-- src |-- Main.java |-- Dockerfile
I use VirtualBox 7.0 with Ubuntu x64 and Docker 24.0.5.
When I try to build the application image from that Dockerfile using this command:
docker build -t hello .
I get this error:
root@ubuntu: /media/sf_IdeaProjects/HelloWorld# docker build -t hello.[+] Building 0.1s (2/2) FINISHED=> [internal] load build definition from Dockerfile=> [internal] load .dockerignore=> => transferring dockerfile: 2B=> => transferring context: 2BERROR: failed to solve: failed to read dockerfile: open /var/snap/docker/common/var-lib-docker/tmp/buildkit-mount1689060805/Dockerfile: no such file or directory
The "IdeaProjects" folder is shared with the VirtualBox guest OS.
Dockerfile
FROM openjdk:17-alpineWORKDIR /appCOPY ./src .RUN javac Main.java CMD ["java", "Main"]
Main.java
public class Main { public static void main(String[] args) { System.out.println("Hello world!"); }}