温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Docker 之 镜像管理

发布时间:2020-02-29 00:53:46 来源:网络 阅读:344 作者:wx592bc92b285c7 栏目:系统运维

一、镜像查询

Docker  之  镜像管理

二、镜像拉取

[root@docker network-scripts]# docker pull alpine
Using default tag: latest      #默认最新版本,可指定版本如:docker pull alpine:3.10.3
latest: Pulling from library/alpine 
e6b0cf9c0882: Pull complete 
Digest: sha256:2171658620155679240babee0a7714f6509fae66898db422ad803b951257db78
Status: Downloaded newer image for alpine:latest
docker.io/library/alpine:latest         #镜像的构

备注:docker pull alpine 可改成 docker.io/library/apline:latest

三、查看本地镜像

[root@docker network-scripts]# docker images      #查看本地镜像
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
alpine              latest              cc0abc535e36        12 days ago         5.59MB
hello-world         latest              fce289e99eb9        12 months ago       1.84kB

四、给镜像打标签

[root@docker network-scripts]# docker tag cc0abc535e36 docker.io/zhoumingkang/alpine:v3.10.3
# cc0abc535e36:镜像IMAGE ID
#docker.io/zhoumingkang/alpine:v3.10.3:镜像的结构
[root@docker network-scripts]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
alpine                latest              cc0abc535e36        12 days ago         5.59MB
zhoumingkang/alpine   v3.10.3             cc0abc535e36        12 days ago         5.59MB
hello-world           latest              fce289e99eb9        12 months ago       1.84kB

五、把zhoumingkang/alpine:v3.10.3推送到自己的仓库上

[root@docker network-scripts]# docker push docker.io/zhoumingkang/alpine:v3.10.3
The push refers to repository [docker.io/zhoumingkang/alpine]
6b27de954cca: Mounted from library/alpine 
v3.10.3: digest: sha256:3983cc12fb9dc20a009340149e382a18de6a8261b0ac0e8f5fcdf11f8dd5937e size: 528

Docker  之  镜像管理

六、移除一个标签

[root@docker network-scripts]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
zhoumingkang/alpine   v3.10.3             cc0abc535e36        12 days ago         5.59MB
alpine                latest              cc0abc535e36        12 days ago         5.59MB
alpine                3.9.4               055936d39205        8 months ago        5.53MB
hello-world           latest              fce289e99eb9        12 months ago       1.84kB
[root@docker network-scripts]# docker rmi docker.io/library/alpine:latest
Untagged: alpine:latest    #移除标签
Untagged: alpine@sha256:2171658620155679240babee0a7714f6509fae66898db422ad803b951257db78
[root@docker network-scripts]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
zhoumingkang/alpine   v3.10.3             cc0abc535e36        12 days ago         5.59MB
alpine                3.9.4               055936d39205        8 months ago        5.53MB
hello-world           latest              fce289e99eb9        12 months ago       1.84kB

七、删除一个镜像

[root@docker network-scripts]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
zhoumingkang/alpine   v3.10.3             cc0abc535e36        12 days ago         5.59MB
alpine                3.9.4               055936d39205        8 months ago        5.53MB
hello-world           latest              fce289e99eb9        12 months ago       1.84kB
[root@docker network-scripts]# docker rmi -f cc0abc535e36
Untagged: zhoumingkang/alpine:v3.10.3
Untagged: zhoumingkang/alpine@sha256:3983cc12fb9dc20a009340149e382a18de6a8261b0ac0e8f5fcdf11f8dd5937e
Deleted: sha256:cc0abc535e36a7ede71978ba2bbd8159b8a5420b91f2fbc520cdf5f673640a34
Deleted: sha256:6b27de954cca6332272e7709b7d8ceccee1489d9452af73391df360a26123580
[root@docker network-scripts]# docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
alpine              3.9.4               055936d39205        8 months ago        5.53MB
hello-world         latest              fce289e99eb9        12 months ago       1.84kB

八、把刚刚删除的镜像,从远程仓库再拉取回来

[root@docker network-scripts]# docker pull docker.io/zhoumingkang/alpine:v3.10.3
v3.10.3: Pulling from zhoumingkang/alpine
e6b0cf9c0882: Pull complete 
Digest: sha256:3983cc12fb9dc20a009340149e382a18de6a8261b0ac0e8f5fcdf11f8dd5937e
Status: Downloaded newer image for zhoumingkang/alpine:v3.10.3
docker.io/zhoumingkang/alpine:v3.10.3
[root@docker network-scripts]# docker images
REPOSITORY            TAG                 IMAGE ID            CREATED             SIZE
zhoumingkang/alpine   v3.10.3             cc0abc535e36        12 days ago         5.59MB
alpine                3.9.4               055936d39205        8 months ago        5.53MB
hello-world           latest              fce289e99eb9        12 months ago       1.84kB

九、Docker 镜像特性

Docker  之  镜像管理

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI