0

I want to create a Dockerfile that has node.js, here is my code:

FROM node:latest

WORKDIR /app

After executing the command docker build . and checking my image with docker image it says <none>

Any ideas?

2 Answers2

3

I understand what you are trying to do. However a little more detail would be nice.

To answer your question, you have at least two methods. The first method would be to tag the image like so: docker build -t image_name .

This is probably the most basic and simplest way. However, if your building this image over and over, then you may want to use a second method, a docker-compose file, like so:

version: '3'

services:
  service:
    build: .
    image: image_name

Inspiration for these examples taken from this SO question

If either of these work for you, please don't forget to accept this answer.

Paul Stoner
  • 1,359
  • 21
  • 44
  • If the linked question answers this one, please flag this as a duplicate rather than adding an answer pointing at it. – David Maze Aug 04 '22 at 23:41
1

Try with

docker build -t image_name .

*--tag , -t --> Name and optionally a tag in the 'name:tag' format

Shamith Wimukthi
  • 468
  • 3
  • 12