理解docker镜像

镜像是用来启动容器的只读模板,是容器启动所需要的rootfs,类似于虚拟机所使用的镜像。

列出本机镜像

[root@localhost ~]# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
busybox latest 020584afccce 7 days ago 1.22MB

[root@localhost ~]# docker images --help

Usage: docker images [OPTIONS] [REPOSITORY[:TAG]]

List images

Options:
-a, --all Show all images (default hides intermediate images)      #列出所有镜像(默认是隐藏中间镜像)
--digests Show digests                       #列出镜像摘要。
-f, --filter filter Filter output based on conditions provided        #条件过滤输出。
--format string Pretty-print images using a Go template        #使用GO模板打印。
--no-trunc Don't truncate output                   #不截断输出。
-q, --quiet Only show numeric IDs                  #仅显示数字标识。

 

下载镜像

[root@localhost ~]# docker pull busybox
Using default tag: latest
latest: Pulling from library/busybox
Digest: sha256:1303dbf110c57f3edf68d9f5a16c082ec06c4cf7604831669faf2c712260b5a0
Status: Image is up to date for busybox:latest
docker.io/library/busybox:latest

导入导出镜像

[root@localhost ~]# docker save -o busybox.tar busybox
[root@localhost ~]# docker load -i busybox.tar
Loaded image: busybox:latest

运行镜像为容器

[root@localhost ~]# docker run busybox:latest

 

 

posted @   星火撩原  阅读(237)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示