docker - 镜像操作(拉取、查看、删除)

文章目录

  • [1、docker search --help(用于显示 Docker 搜索命令的帮助信息)](#1、docker search --help(用于显示 Docker 搜索命令的帮助信息))
  • [2、docker pull(拉取镜像)](#2、docker pull(拉取镜像))
  • [3、docker images (查看镜像)](#3、docker images (查看镜像))
    • [3.1、docker images --help(用于显示 Docker 镜像管理相关命令的帮助信息)](#3.1、docker images --help(用于显示 Docker 镜像管理相关命令的帮助信息))
    • [3.2、docker images -q(用于列出所有本地 Docker 镜像的 ID)](#3.2、docker images -q(用于列出所有本地 Docker 镜像的 ID))
  • [4、docker rmi redis:7.0.10(删除镜像)](#4、docker rmi redis:7.0.10(删除镜像))

docker search --help 命令用于显示 Docker 搜索命令的帮助信息。这个命令会列出所有与 docker search 相关的选项和它们的用法说明,帮助你理解如何使用这个命令来搜索 Docker Hub 或其他配置的 Docker 仓库中的镜像。

sh 复制代码
[root@localhost ~]# docker search --help

Usage:  docker search [OPTIONS] TERM

Search Docker Hub for images

Options:
  -f, --filter filter   Filter output based on conditions provided
      --format string   Pretty-print search using a Go template
      --limit int       Max number of search results
      --no-trunc        Don't truncate output

2、docker pull(拉取镜像)

sh 复制代码
命令: docker pull
格式: docker pull 镜像名称[:tag]	# tag表示的镜像的标签,也可以理解为就是镜像的版本
# 默认拉取的是最新的redis镜像
docker pull redis			   
# 拉取redis7.0.10镜像,一个镜像到底存在哪些标签,需要上docker hub中进行查看
docker pull redis:7.0.10	   

执行效果如下所示:

sh 复制代码
[root@localhost ~]# docker pull redis:7.0.10
7.0.10: Pulling from library/redis
26c5c85e47da: Pull complete 
39f79586dcf2: Pull complete 
79c71d0520e5: Pull complete 
839b5a82ec1e: Pull complete 
3cf4217d20ac: Pull complete 
7ced743e94cb: Pull complete 
Digest: sha256:92b8b307ee28ed74da17578064c73307ad41e43f422f0b7e4e91498b406c59e3
Status: Downloaded newer image for redis:7.0.10
docker.io/library/redis:7.0.10

3、docker images (查看镜像)

sh 复制代码
[root@localhost ~]# docker images
REPOSITORY               TAG       IMAGE ID       CREATED         SIZE
bitnami/kafka            latest    bc7700d07f0b   4 months ago    623MB
quay.io/minio/minio      latest    b1b460d8cc87   8 months ago    151MB
mongo                    7.0.0     00307f461add   12 months ago   735MB
kibana                   8.8.2     e2f9d35de731   15 months ago   876MB
elasticsearch            8.8.2     673e6376a286   15 months ago   1.34GB
nacos/nacos-server       v2.2.2    0514f8ffee17   17 months ago   1.17GB
redis                    7.0.10    33e3db53b328   17 months ago   117MB
nickzurich/efak          latest    48e4cf545b5a   2 years ago     809MB
bitnami/zookeeper        latest    15e78766ee47   2 years ago     468MB
wurstmeister/kafka       latest    2dd91ce2efe1   2 years ago     508MB
nginx                    latest    605c77e624dd   2 years ago     141MB
zookeeper                latest    36c607e7b14d   2 years ago     278MB
redis                    latest    7614ae9453d1   2 years ago     113MB
mysql                    8         3218b38490ce   2 years ago     516MB
wurstmeister/zookeeper   latest    3f43f72cb283   5 years ago     510MB

3.1、docker images --help(用于显示 Docker 镜像管理相关命令的帮助信息)

sh 复制代码
[root@localhost ~]# docker images --help

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

List images

Aliases:
  docker image ls, docker image list, docker 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   Format output using a custom template:
                        'table':            Print output in table format with column headers (default)
                        'table TEMPLATE':   Print output in table format using the given Go template
                        'json':             Print in JSON format
                        'TEMPLATE':         Print output using the given Go template.
                        Refer to https://docs.docker.com/go/formatting/ for more information about formatting output with templates
      --no-trunc        Don't truncate output
  -q, --quiet           Only show image IDs

3.2、docker images -q(用于列出所有本地 Docker 镜像的 ID)

sh 复制代码
[root@localhost ~]# docker images -q
bc7700d07f0b
b1b460d8cc87
00307f461add
e2f9d35de731
673e6376a286
0514f8ffee17
33e3db53b328
48e4cf545b5a
15e78766ee47
2dd91ce2efe1
605c77e624dd
36c607e7b14d
7614ae9453d1
3218b38490ce
3f43f72cb283

4、docker rmi redis:7.0.10(删除镜像)

sh 复制代码
[root@localhost ~]# docker rmi redis:7.0.10
Untagged: redis:7.0.10
Untagged: redis@sha256:92b8b307ee28ed74da17578064c73307ad41e43f422f0b7e4e91498b406c59e3
Deleted: sha256:33e3db53b328be5c7782f3ff3ff52ea9478d7492fb10cb23c05fd2517dd90137
Deleted: sha256:5a16f1682cf683b685415b8e339f0e80d5a185683f418dfafd03f0724ac269ca
Deleted: sha256:dc185d8d03d4e21b5efb0a8703b1090717e6effe6fd06d41afaca09a2bbfa04d
Deleted: sha256:e28fc6cc074ba3bf1762928841a315178f77d58784721841b527fbd11550557e
Deleted: sha256:6e75f4867056adfca8dfafbb0e94a525064797e4f0a106bca817b5afce47af73
Deleted: sha256:84e4c46eefa83bc327e4e356365ec03a3ee1f691d181235e5b69e36663f7dd57
Deleted: sha256:ed7b0ef3bf5bbec74379c3ae3d5339e666a314223e863c70644f7522a7527461
相关推荐
哲伦贼稳妥5 分钟前
一天认识一个硬件之音响与音箱
运维·其他·计算机外设·电脑
Studying_swz14 分钟前
Nginx反向代理配置支持websocket
运维·websocket·nginx
行走的山峰33 分钟前
k8s删除和添加node节点
云原生·容器·kubernetes
小小不董41 分钟前
图文深入理解Oracle Network配置管理(一)
运维·数据库·oracle·dba
wht65871 小时前
Linux--基本指令
linux·运维·服务器·c语言·开发语言·jvm·c++
浊尘1 小时前
在Kali Linux中使用VNC和iptables配置xrdp以实现远程连接
linux·运维·服务器
tlkqx374491 小时前
服务器遭遇恶意流量的应对策略
运维·服务器
iot_qizu1 小时前
Ubuntu环境切换到服务器某个用户后source等命令和Tab快捷补全都用不了了,提示没找到,但root用户可以
linux·运维·服务器·ubuntu
Narnat1 小时前
linux项目_c语言:Makefile编写、动态库生成、添加动态库路径
linux·运维·c语言
LXMXF2 小时前
华为-单臂路由
运维·网络·华为