封尘网

让学习成为一种习惯!

Docker 的镜像名和TAG都为none时的解决方法

首先,要了解为什么会出现这个none?

一般在制作Docker镜像时已经存在的的REPOSITORY【仓库名】和TAG名,然而还添加了一个一样的仓库名并未以TAG识别来分开所致。

可能说得不清楚,看实例:

[root@Docker centos]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos6.5           v2                  819f53017d76        55 minutes ago      254.8 MB
centos6.5           v1                  af63c745e933        57 minutes ago      314.9 MB
centos6.5           latest              dbb23486dd09        About an hour ago   370.9 MB
centos              latest              60e65a8e4030        2 weeks ago         196.6 MB
centos              centos7.1.1503      fab4b1df8eb1        3 months ago        212.1 MB

注意:上面已经存在centos6.5 v2的镜像,我接下来再利用添加一个一样的仓库名为centos6.5 TAG同样为v2就会出现如下情况:

[root@Docker data]# cd centos && tar -c .|docker import - centos6.5:v2
434c6fa14315f5b2c1a977eafb30f1b6f018a890e0ea59d1bfe7a700d1719b32

查看本机镜像列表

[root@Docker centos]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos6.5           v2                  434c6fa14315        9 seconds ago       254.8 MB
<none>              <none>              819f53017d76        56 minutes ago      254.8 MB
centos6.5           v1                  af63c745e933        58 minutes ago      314.9 MB
centos6.5           latest              dbb23486dd09        About an hour ago   370.9 MB
centos              latest              60e65a8e4030        2 weeks ago         196.6 MB
centos              centos7.1.1503      fab4b1df8eb1        3 months ago        212.1 MB

原来的centos6.5 v2的镜像已经变成了none,我们通过后面的IMAGE ID就可以识别了。

使用是不影响的,但是不太好识别。如何修改呢?

语法:docker tag [IMAGE ID] [REPOSITORY名]:[TAG标识]

[root@Docker centos]# docker tag 819f53017d76 centos65:6.5

[root@Docker centos]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
centos6.5           v2                  434c6fa14315        8 minutes ago       254.8 MB
centos65            6.5                 819f53017d76        About an hour ago   254.8 MB
centos6.5           v1                  af63c745e933        About an hour ago   314.9 MB
centos6.5           latest              dbb23486dd09        About an hour ago   370.9 MB
centos              latest              60e65a8e4030        2 weeks ago         196.6 MB
centos              centos7.1.1503      fab4b1df8eb1        3 months ago        212.1 MB

这样就修改过来了。

提醒:本文最后更新于 2811 天前,文中所描述的信息可能已发生改变,请谨慎使用。