暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Docker的镜像基础管理

原创 鸿惊九天 2023-06-15
243
## 4.1  获取镜像

基础镜像拉取
docker search centos
docker pull centos:6.9
docker pull centos:7.5.1804
docker pull nginx

## 4.2 镜像基本查看

[root@docker ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 6.8 82f3b5f3c58f 4 months ago 195 MB
centos 6.9 2199b8eb8390 4 months ago 195 MB
centos 7.5.1804 cf49811e3cdb 4 months ago 200 MB
centos 7.6.1810 f1cb7c7d58b7 4 months ago 202 MB
oldguo/centos_sshd v1.0
oldguo/centos_sshd v2.0
oldguo/centos_sshd v3.0
标识镜像唯一性的方法:

  1. REPOSITORY:TAG
    centos:7.5.1804
  2. IMAGE ID (sha256:64位的号码,默认只截取12位)
    82f3b5f3c58
    [root@docker /]# docker image ls --no-trunc
## 4.3 镜像详细信息查看

[root@docker /]# docker image inspect ubuntu:latest
[root@docker /]# docker image inspect 82f3b5f3c58f

## 4.4 只查看镜像ID 

[root@docker ~]# docker image ls -q

## 4.5 镜像的导入和导出

[root@docker ~]# docker image save 3556258649b2 >/tmp/ubu.tar
[root@docker ~]# docker image rm 3556258649b2
[root@docker ~]# docker image load -i /tmp/ubu.tar
[root@docker ~]# docker image tag 3556258649b2 oldguo/ubu:v1

## 4.6 镜像的删除 

[root@docker ~]# docker image rm -f 3556258649b2
[root@docker ~]# docker image rm -f docker image ls -q

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论