I am trying to build a docker image on my windows machine and I keep getting this error:
[+] Building 2.1s (12/15)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 538B 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 35B 0.0s
=> [internal] load metadata for docker.io/library/node:alpine 1.0s
=> [ 1/11] FROM docker.io/library/node:alpine@sha256:6b56197d33a56cd45d1d1214292b8851fa1b91b2ccc678cee7e5fd4260bd8fae 0.0s
=> [internal] load build context 1.0s
=> => transferring context: 15.72kB 1.0s
=> CACHED [ 2/11] WORKDIR /app 0.0s
=> CACHED [ 3/11] COPY package.json . 0.0s
=> CACHED [ 4/11] COPY tsconfig.json . 0.0s
=> CACHED [ 5/11] COPY swagger.yaml . 0.0s
=> CACHED [ 6/11] COPY services . 0.0s
=> CACHED [ 7/11] RUN yarn install 0.0s
=> ERROR [ 8/11] ADD . /app 0.0s
------
> [ 8/11] ADD . /app:
------
cannot copy to non-directory: /var/lib/docker/overlay2/xw77p2bxfkhhnwqs5umpl7cbi/merged/app/.git
My Dockerfile is the following:
FROM node:alpine
#Create Directory for the Container
WORKDIR /app
#Copy the package.json and tsconfig.json to work directory
COPY package.json .
COPY tsconfig.json .
COPY swagger.yaml .
COPY services .
#Install all packages
RUN yarn install
#Copy all other source code to work directory
ADD . /app
#Build sources
RUN yarn run build
#Clean src directory
RUN rm -rf ./src/
RUN rm -rf ./services/src/
#Expose Ports
EXPOSE 3000
#Entry
CMD ["yarn", "start"]
This Dockerfile works on my colleagues' Linux machines but fails on my windows machine.
This is my Docker version
Docker version 20.10.7, build f0df350
Running on windows and using the wsl 2 to interact with it.
But the build also fails using the Windows command prompt.
Thank you in advance for the help!