Search code examples
dockerdockerfile

docker image to docker file through vscode


I am unable to build docker file from docker image. (docker build -t thisismyfirstdocker .)

PS C:\Docker1\python-image> docker build -t thisismyfrstdocker .  
[+] Building 0.2s (2/2) FINISHED                                                                              docker:default
 => [internal] load build definition from Dockerfile                                                                    0.0s
 => => transferring dockerfile: 31B                                                                                     0.0s 
 => [internal] load .dockerignore                                                                                       0.1s 
 => => transferring context: 2B                                                                                         0.0s 
ERROR: failed to solve: the Dockerfile cannot be empty
ERROR: failed to solve: the Dockerfile cannot be empty

I am trying to build dockerfile in vscode and expecting to build it but I got the error:

ERROR: failed to solve: the Dockerfile cannot be empty


Solution

  • There are some know issues that cause this:

    1. not capitalized dockerfile

    2. point to the build by -f flag:

      docker build -t thisismyfirstdocker -f somefile .

    3. Change COPY to ADD. (Here)