REPOSITORY TAG

2019-06-03 12:44发布

问题:

I am new here trying to learn docker, I started this tutorial

https://docs.docker.com/engine/examples/nodejs_web_app/

Building your image

$ docker build -t mlotfi/centos-node-hello .

mlotfi is my username in https://hub.docker.com/

when I did docker images, I got:

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
<none>              <none>              sha256:189cb        27 seconds ago      485.1 MB
centos              centos6             sha256:d0a31        12 days ago         228.9 MB

instead of:

REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
mlotfi/centos-node-hello   latest              sha256:189cb        27 seconds ago      485.1 MB
centos              centos6             sha256:d0a31        12 days ago         228.9 MB

UPDATE: at the end of the build I see :

Complete!
---> e053d8f57e5c
Removing intermediate container 060f921fd08c
Step 4 : COPY package.json /src/package.json
SECURITY WARNING: You are building a Docker image from Windows against a  non-Windows Docker host. All files and
directories added to build context will have '-rwxr-xr-x' permissions. It is  recommended to double check and r
eset permissions for sensitive files and directories.
lstat package.json: no such file or directory

But I already have package.json in the src directory.

回答1:

That can happen if your docker build sequence does not got all the way, meaning it stops on error at some point in the Dockerfile.

The result of that interrupted process is the last intermediate image built by the Dockerfile line that succeeded, just before the Dockerfile line that fail to execute properly.

Other reasons are listed in "What are Docker <none>:<none> images? "

Each docker image is composed of layers, with these layers having a parent-child hierarchical relationship with each other.
All docker file system layers are by default stored at /var/lib/docker/graph. Docker calls it the graph database

<none>:<none> images stand for. They stand for intermediate images and can be seen using docker images -a.

Another style of <none>:<none> images are the dangling images which can cause disk space problems.
A dangling image and needs to be pruned. When our hello_world image was rebuilt using the Dockerfile, its reference to old Fedora became untagged and dangling.

you can see an example of dangling image in "What are <none> repository and tags? Why do they appear when I use docker build?".

The next command can be used to clean up these dangling images.

docker rmi $(docker images -f "dangling=true" -q)

In your case, if this was the first time your used docker build, this should not be a dangling image, but an intermediate one as I explained first in this answer.



标签: docker