When I run docker-compose build
to build my container using Docker Desktop for Windows, I get the following output:
[+] Building 4.3s (6/16) docker:default
=> [web internal] load build definition from Dockerfile.dev
=> => transferring dockerfile: 769B
=> [web internal] load .dockerignore
=> => transferring context: 162B
=> [web internal] load metadata for docker.io/library/node:14.15.4-alpine3.10
=> [web auth] library/node:pull token for registry-1.docker.io
=> CANCELED [web 1/11] FROM docker.io/library/node:14.15.4-alpine3.10@sha256:fe215d05cdde4b7f2a0f546c88a8ddc4f5
=> => resolve docker.io/library/node:14.15.4-alpine3.10@sha256:fe215d05cdde4b7f2a0f546c88a8ddc4f5fa280a204acdfc2 0.0s
=> => sha256:fe215d05cdde4b7f2a0f546c88a8ddc4f5fa280a204acdfc2383afe901fd6d84 1.43kB / 1.43kB
=> => sha256:3c1278b4775e0531a87c5f59e281e9fd3e9415510f736f6cb7b853a18f733c65 1.16kB / 1.16kB
=> => sha256:1d5f426329f6457972282c871eeae61741de2103bdb13200f3cff390d70f1734 6.73kB / 6.73kB
=> => sha256:21c83c5242199776c232920ddb58cfa2a46b17e42ed831ca9001c8dbc532d22d 0B / 2.80MB
=> => sha256:183201ed1f3fde3d0aa37b312d28e31b6129f0ab073fadb40f002bf3bac7e096 0B / 35.65MB
=> => sha256:61208a7901b0da939053e657b8b0a56fda12331176c5bbe510aa76395c9208fc 0B / 2.24MB
=> CANCELED [web internal] load build context
=> => transferring context: 6.54MB
failed to solve: Canceled: context canceled
Dockerfile:
# build environment
FROM node:14.15.4-alpine3.10 as build
ARG SSH_PRV_KEY
RUN apk update && \
apk add git && \
apk add openssh
# Authorize SSH Host
RUN mkdir -p /root/.ssh && \
chmod 700 /root/.ssh && \
ssh-keyscan -t rsa bitbucket.org > /root/.ssh/known_hosts
# Add the keys and set permissions
RUN echo "$SSH_PRV_KEY" > /root/.ssh/id_rsa && \
chmod 600 /root/.ssh/id_rsa && \
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub && \
chmod 600 /root/.ssh/id_rsa.pub
RUN mkdir /code
WORKDIR /code
ENV PATH /code/node_modules/.bin:$PATH
ENV PORT=5000
ENV REACT_APP_BUILD_ENV='development'
COPY . ./
# RUN npm ci --silent
CMD ["npm", "start"]
.dockerignore
.DS_Store
**/.DS_Store
.dockerignore
Dockerfile
docker-compose.yml
.git
.gitignore
.idea/
.vscode
.env
npm-debug.log
This causes the build to fail.
I'm not sure how to debug this as I'm not very familiar with Docker. My internet connection seems to be fine and it always fails at the same step no matter how many times I run it. So far, I've tried the following:
--no-cache
flag to the build command.docker-compose build --no-cache
in an administrative Command Prompt..git
was added to the .dockerignore
file.docker login
.docker logout
and docker login
.A coworker of mine was able to solve this issue by downgrading Docker from 4.24.1 back to 4.22.0 and doing a full system reset afterwards (not sure if that was necessary, you could try just the downgrade first).
This was a Windows-specific issue; other people with Docker Desktop for Mac did not encounter this.