Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

docker build with Dockerfile, but the image has no name or tag

I installed Docker desktop for mac. The version is 1.12.0-rc4-beta19

when I use docker build -t self/centos:java8 .

the image has no name or tag

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE <none>              <none>              1581ffcbfd7f        5 minutes ago       196.8 MB 

What is wrong with the build command?

like image 333
viewking Avatar asked Jul 19 '16 11:07

viewking


People also ask

Does a docker image need a tag?

We can also build a Docker image without using any tag. Docker always points to the latest stable release using the latest tag. Old releases can even be called the latest. But we can't predict whether it is a major or minor version.

How do I tag an image in Dockerfile?

When we use the Docker build command to build an image from a Dockerfile, we use the -t option to give a name and tag to the image. For example, let's check out the Dockerfile and the command below. $ docker build -t myubuntuimage:version1 .

How do I name an image in docker?

You can rename your docker image by docker tag command. Use the below given command to do that. To rename docker container, use the rename sub-command as shown, in the following example, we renaming the container discourse_app to a new name disc_app.


1 Answers

is your image building correctly? the name does not get set when there is an error in the build. This because every step in the build is a new image created and with an error you won't get to the last step with the correctly named image

btw you can set it manually with the tag command https://docs.docker.com/engine/reference/commandline/tag/

like image 79
Zeromus Avatar answered Oct 04 '22 14:10

Zeromus