Reputation: 7041
My Dockerfile:
FROM ubuntu:latest
ENV STAR_VERSION=2.7.3a
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y git-all \
&& apt-get install -y --no-install-recommends apt-utils \
&& apt-get install -y --no-install-recommends build-essential \
&& apt-get install -y make \
&& apt-get install -y libz.dev \
&& echo "downloading ${STAR_VERSION}"
WORKDIR /mnt/d/github/Docker/STAR_2.7.3a/
RUN git clone https://github.com/alexdobin/STAR.git \
&& cd STAR/source \
&& echo "making STAR ${STAR_VERSION}" \
&& make STAR
CMD ["STAR", "--version"]
Build image:
docker image build .
It showed it's successfully built (with some warnings though) but when I check it
$ docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> e57297dc089d 29 minutes ago 1.41GB
<none> <none> 8c4d6c6be0d2 About an hour ago 915MB
<none> <none> a2625623ebb7 2 hours ago 754MB
$ docker image ls --filter dangling=true
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> e57297dc089d 30 minutes ago 1.41GB
<none> <none> 8c4d6c6be0d2 About an hour ago 915MB
<none> <none> a2625623ebb7 2 hours ago 754MB
Why are they all danging and no tags?
Upvotes: 2
Views: 585
Reputation: 39079
Per default, the images that you build from a Dockerfile are untagged, and unamed.
You need to pass a repo:tag
as option to the build command in order to tag them.
docker image build --tag some/repo:tag .
From the documentation:
--tag , -t Name and optionally a tag in the ‘name:tag’ format
Source: https://docs.docker.com/engine/reference/commandline/image_build/
Mind that: untagged images can also happen if you retag an another image with the same tag, so to say, stealing the tag from an existing image, leaving the old image untagged.
This will display untagged images that are the leaves of the images tree (not intermediary layers). These images occur when a new build of an image takes the
repo:tag
away from the image ID, leaving it as<none>:<none>
or untagged. A warning will be issued if trying to remove an image when a container is presently using it. By having this flag it allows for batch cleanup.
Source: https://docs.docker.com/engine/reference/commandline/images/#filtering
Upvotes: 3