Home > OS >  Docker image name is <none> after build
Docker image name is <none> after build

Time:08-05

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?

CodePudding user response:

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.

CodePudding user response:

Try with

docker build -t image_name .

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

  • Related