Docker gets error “failed to compute cache key: not found” – runs fine in Visual Studio

Check your .dockerignore file. Possible it ignores needed files for copy command and you get failed to compute cache key error.

.dockerignore may be configured to minimize the files sent to docker for performance and security:

* 
!dist/

The first line * disallows all files. The second line !dist/ allows the dist folder

This can cause unexpected behavior:

FROM nginx:latest

# Fails because of * in .dockerignore
# failed to compute cache key: "/nginx.conf.spa" not found: not found
# Fix by adding `!nginx.conf.spa`  to .dockerignore
COPY nginx.conf.spa /etc/nginx/nginx.conf

RUN mkdir /app

# Works because of !dist/ in .dockerignore
COPY dist/spa /app

Belts and suspenders.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)