搜索docker镜像
docker search centos
NAME DESCRIPTION STARS OFFICIAL
centos DEPRECATED; The official build of CentOS. 7771 [OK]
centos/postgresql-10-centos7 PostgreSQL is an advanced Object-Relational … 21
corpusops/centos centos corpusops baseimage 0
centos/httpd-24-centos8 3
centos/redis-5-centos8 0
centos/postgresql-96-centos7 PostgreSQL is an advanced Object-Relational … 45
centos/postgresql-10-centos8 0
centos/systemd systemd enabled base container. 115
centos/mariadb-103-centos8 2
centos/mysql-56-centos7 MySQL 5.6 SQL database server 23
centos/postgresql-12-centos8 0
centos/mariadb-102-centos7 MariaDB 10.2 SQL database server 6
centos/mysql-80-centos8 0
docker search centos --limit 5
搜索效果如下图所示,其提供了五个字段,分别代表的含义解释如下:
NAME:镜像的名称。
DESCRIPTION:镜像的描述信息。
STARS:镜像的星星数量,星星越多,说明受欢迎度越高哟~
OFFICIAL:该镜像是否是官方发布。
AUTOMATED:该镜像是否支持支持自动化构建功能。
下载镜像
docker pull centos
Using default tag: latest
latest: Pulling from library/centos
a1d0c7532777: Pull complete
Digest: sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest
查看本地镜像列表
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
centos latest 5d0da3dc9764 3 years ago 231MB
导出镜像
docker save -o centos.tar.gz centos
##最好用镜像名字,不要用镜像id,因为用镜像id导出再导入的镜像没有版本,将会是none
删除镜像
docker rmi centos
Untagged: centos:latest
Untagged: centos@sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177
Deleted: sha256:5d0da3dc976460b72c77d94c8a1ad043720b0416bfc16c52c45d4847e53fadb6
Deleted: sha256:74ddd0ec08fa43d09f32636ba91a0a3053b02cb4627c35051aff89f853606b59
-f:代表强制删除
导入镜像
docker load -i centos.tar.gz
74ddd0ec08fa: Loading layer [==================================================>] 238.6MB/238.6MB
Loaded image: centos:latest
打标签
docker image tag centos centos:zqf
清除无效镜像
我们可以清理无效的镜像。所谓的无效的镜像我们指的就是没有镜像名称和标签的。
docker image prune