unauthorized: authentication required error while creating docker nodejs image

  build, docker, node.js

I am new to docker and trying to build docker image for my nodejs project.

This is my docker file

FROM node:10
COPY package*.json ./
RUN npm install
COPY . .
CMD ["node", "index.js"]

Command used to build the image

docker build -r test-project .

It is giving unauthorized: authentication required after few minutes

Step 1/7 : FROM node:10
10: Pulling from library/node
76b8ef87096f: Extracting [====================>                              ]  18.81MB/45.38MB
2e2bafe8a0f4: Download complete
b53ce1fd2746: Download complete
84a8c1bd5887: Downloading [==============================>                    ]  30.38MB/49.79MB
7a803dc0b40f: Downloading [========>                                          ]  34.34MB/214.3MB
b800e94e7303: Downloading
0da9fbf60d48: Waiting
04dccde934cf: Waiting
73269890f6fd: Waiting
**unauthorized: authentication required**

I have done authentication before starting build using

docker login -u <username>

Please help with authentication error while building docker image.

Source: Docker Questions