0

I am new into docker. I am using linux to run docker. Docker successfully installed. But When I run docker command sudo docker build . I always getting the error. How can i solve the issue?

Error screnshot

My docker file is

FROM node:14

WORKDIR /app

COPY package.json .

RUN npm install


COPY . .

EXPOSE 3000

CMD [ "node", 'app.mjs' ]

Nodejs package.json file

{
  "name": "1_getting-_started_docker",
  "version": "1.0.0",
  "description": "",
  "main": "app.mjs",
  "type": "module",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  }
}

app.mjs

import express from 'express'

import { connectToDatabase } from './helpers.mjs';

const app = express();

app.get('/', (request, response) => {
    response.send('<h1>Hi there</h1>');
});

await connectToDatabase();

// https://robinwinslow.uk/fix-docker-networking-dns

1 Answer 1

1

The Dockerfile looks fine, so it is very likely related to the Docker installation. You should probably try to restart the docker daemon: https://docs.docker.com/config/daemon/systemd/ and/or restarting your computer.

If that doesn't work pls show your complete logs that appear on the error message.

4
  • M. Perez This is my daemon.json file. Is this correct? I am still getting the same error. { "dns": ["118.179.223.10", "8.8.8.8"], "data-root": "/mnt/docker-data", "storage-driver": "overlay2" } Mar 29, 2021 at 4:33
  • Which logs file you want nodejs or Docker? Mar 29, 2021 at 4:35
  • see your picture, the line before the last one indicate a path the see the log: /root/.npm/_logs.......
    – Jerome
    Mar 29, 2021 at 5:49
  • Yes what @Jerome said, look at the path of the error message: /root/.npm ...
    – M. Perez
    Mar 30, 2021 at 22:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.