skip to Main Content

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

Answers


  1. 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.

    Login or Signup to reply.
  2. Try with

    docker build -t image_name .
    

    *–tag , -t –> Name and optionally a tag in the ‘name:tag’ format

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search