I have the below project structure Show
And I have one directory in bin directory anycodings_visual-studio-2019 that name is app.publish. And my Dockerfile is like below:
After I run below command to build image anycodings_visual-studio-2019 from this docker file
I got the below error
My question is why I got this error? and how anycodings_visual-studio-2019 to resolve it? I use Docker Engine Community 20.10.6 on anycodings_visual-studio-2019 Windows 10 20H2 19042.964 I see Docker - failed to compute cache key: anycodings_visual-studio-2019 not found - runs fine in Visual Studio and anycodings_visual-studio-2019 some internal links, but does not find any anycodings_visual-studio-2019 useful things. I am binging my problem and find some same anycodings_visual-studio-2019 problem like Dockerfile can’t anycodings_visual-studio-2019 copy specified local directory & file or anycodings_visual-studio-2019 Windows Docker Dockerfile COPY file inside anycodings_visual-studio-2019 folder. 24 Answers 1 : of Docker build failed to compute cache keyThanks to BMitch, I found my problem. anycodings_dockerfile The problem is the dockerignore file anycodings_dockerfile contains some pattern that must not anycodings_dockerfile match with COPY files name. My problem is the patterns inside the anycodings_dockerfile dockerignore file is matched wrongly anycodings_dockerfile with bin/app.publish. To resolve my anycodings_dockerfile problem I just change the pattern in anycodings_dockerfile dockerignore. 0 2022-09-22T04:18:02+00:00 2022-09-22T04:18:02+00:00Answer Link mRahman 2 Answers 2 : of Docker build failed to compute cache keyThis might be of some help to others: I am building a .NET Core application anycodings_dockerfile with a dockerfile and had been doing anycodings_dockerfile some renaming. I got the "failed to anycodings_dockerfile compute cache key" error, because the anycodings_dockerfile filenames in the dockerfile no longer anycodings_dockerfile matched the new names I had given to the anycodings_dockerfile targeted files. Once I fixed the naming in the anycodings_dockerfile dockerfile, everything worded as anycodings_dockerfile expected. 0 2022-09-22T04:18:02+00:00 2022-09-22T04:18:02+00:00Answer Link joy What does Workdir do in Dockerfile?The WORKDIR command is used to define the working directory of a Docker container at any given time. The command is specified in the Dockerfile. Any RUN , CMD , ADD , COPY , or ENTRYPOINT command will be executed in the specified working directory.
Where should Dockerignore file be?The . dockerignore file is a special file that can be placed within the build context directory. The build context directory is the directory that we specify at the end of a docker build command.
What is difference between ADD and copy in Dockerfile?COPY is a docker file command that copies files from a local source location to a destination in the Docker container. ADD command is used to copy files/directories into a Docker image. It only has only one assigned function. It can also copy files from a URL.
What is a Docker build context?The docker build command builds Docker images from a Dockerfile and a “context”. A build's context is the set of files located in the specified PATH or URL . The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.
|