skip to Main Content
user:/mnt/a/Projects/dir$ sudo docker build .
[+] Building 0.0s (2/2) FINISHED                                                                                                                                  docker:default
 => [internal] load build definition from Dockerfile                                                                                                                        0.0s
 => => transferring dockerfile: 2B                                                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                             0.0s
ERROR: failed to solve: failed to read dockerfile: open /var/snap/docker/common/var-lib-docker/tmp/buildkit-mount3069745600/Dockerfile: no such file or directory
user:/mnt/a/Projects/dir$ ls
Dockerfile  node_modules  package.json  package-lock.json  public  README.md  src  vk-hosting-config.json
user:/mnt/a/Projects/dir$ cd Docker
user:/mnt/a/Projects/dir/Docker$ ls
Dockerfile
user:/mnt/a/Projects/dir/Docker$ sudo docker build .
[+] Building 0.1s (2/2) FINISHED                                                                                                                                  docker:default
 => [internal] load build definition from Dockerfile                                                                                                                        0.0s
 => => transferring dockerfile: 2B                                                                                                                                          0.0s
 => [internal] load .dockerignore                                                                                                                                           0.0s
 => => transferring context: 2B                                                                                                                                             0.0s
ERROR: failed to solve: failed to read dockerfile: open /var/snap/docker/common/var-lib-docker/tmp/buildkit-mount3184267428/Dockerfile: no such file or directory

All I see around on the web is advice on checking if the name is right, whether I’m in the right directory (done twice, including a directory where literally nothing besides the Dockerfile exists).

Providing /mnt/a/Projects/dir instead of . as context does nothing.

I’ve also tried various combinations for the -f flag (-f ./Dockerfile, -f Dockerfile in both the regular project folder and the Docker folder) — no dice.

Combining the last two options (full path to Dockerfile inside context, full path to context in one command) also didn’t help.

What do?

2

Answers


  1. Chosen as BEST ANSWER

    sudo docker build - < Dockerfile sufficed, but I'm still curious on why it didn't see the file until I literally dumped it in.


  2. I had to uninstall snap docker completely and install docker properly as described in the answer here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search