文章目录

  • docker help
  • docker image相关的命令
    • docker images 查看所有本地的主机上的镜像
    • docker search 搜索镜像
    • docker pull 下载镜像
    • docker rmi 删除镜像
    • 其他....


docker help

[root@VM-0-7-centos ~]# docker helpUsage:  docker [OPTIONS] COMMANDA self-sufficient runtime for containersOptions:--config string      Location of client config files (default "/root/.docker")-c, --context string     Name of the context to use to connect to the daemon (overrides DOCKER_HOST env var and default contextset with "docker context use")-D, --debug              Enable debug mode-H, --host list          Daemon socket(s) to connect to-l, --log-level string   Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")--tls                Use TLS; implied by --tlsverify--tlscacert string   Trust certs signed only by this CA (default "/root/.docker/ca.pem")--tlscert string     Path to TLS certificate file (default "/root/.docker/cert.pem")--tlskey string      Path to TLS key file (default "/root/.docker/key.pem")--tlsverify          Use TLS and verify the remote-v, --version            Print version information and quitManagement Commands:app*        Docker App (Docker Inc., v0.9.1-beta3)builder     Manage buildsbuildx*     Build with BuildKit (Docker Inc., v0.6.1-docker)config      Manage Docker configscontainer   Manage containerscontext     Manage contextsimage       Manage imagesmanifest    Manage Docker image manifests and manifest listsnetwork     Manage networksnode        Manage Swarm nodesplugin      Manage pluginsscan*       Docker Scan (Docker Inc., v0.8.0)secret      Manage Docker secretsservice     Manage servicesstack       Manage Docker stacksswarm       Manage Swarmsystem      Manage Dockertrust       Manage trust on Docker imagesvolume      Manage volumesCommands:attach      Attach local standard input, output, and error streams to a running containerbuild       Build an image from a Dockerfilecommit      Create a new image from a container's changescp          Copy files/folders between a container and the local filesystemcreate      Create a new containerdiff        Inspect changes to files or directories on a container's filesystemevents      Get real time events from the serverexec        Run a command in a running containerexport      Export a container's filesystem as a tar archivehistory     Show the history of an imageimages      List imagesimport      Import the contents from a tarball to create a filesystem imageinfo        Display system-wide informationinspect     Return low-level information on Docker objectskill        Kill one or more running containersload        Load an image from a tar archive or STDINlogin       Log in to a Docker registrylogout      Log out from a Docker registrylogs        Fetch the logs of a containerpause       Pause all processes within one or more containersport        List port mappings or a specific mapping for the containerps          List containerspull        Pull an image or a repository from a registrypush        Push an image or a repository to a registryrename      Rename a containerrestart     Restart one or more containersrm          Remove one or more containersrmi         Remove one or more imagesrun         Run a command in a new containersave        Save one or more images to a tar archive (streamed to STDOUT by default)search      Search the Docker Hub for imagesstart       Start one or more stopped containersstats       Display a live stream of container(s) resource usage statisticsstop        Stop one or more running containerstag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGEtop         Display the running processes of a containerunpause     Unpause all processes within one or more containersupdate      Update configuration of one or more containersversion     Show the Docker version informationwait        Block until one or more containers stop, then print their exit codesRun 'docker COMMAND --help' for more information on a command.To get more help with docker, check out our guides at https://docs.docker.com/go/guides/
[root@VM-0-7-centos ~]#

来看看几个和帮助相关的命令

# 显示docker版本信息
[root@VM-0-7-centos ~]# docker version  # 显示docker系统信息,包括镜像和容器数量
[root@VM-0-7-centos ~]# docker info      # 帮助信息
[root@VM-0-7-centos ~]# docker COMMAND  --help Run 'docker COMMAND --help' for more information on a command.

文档: https://docs.docker.com/engine/reference/commandline/docker/


docker image相关的命令

文档: https://docs.docker.com/engine/reference/commandline/image/

docker images 查看所有本地的主机上的镜像

https://docs.docker.com/engine/reference/commandline/images/

【使用】

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

【demo】


[root@VM-0-7-centos ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
hello-world   latest    feb5d9fea6a5   12 days ago   13.3kB
# 解释
REPOSITORY   镜像的仓库源
TAG          镜像的标签
IMAGE ID     镜像的id
CREATED      镜像的创建时间
SIZE         镜像的大小


docker search 搜索镜像

[root@VM-0-7-centos ~]# docker search tomcat
NAME                          DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
tomcat                        Apache Tomcat is an open source implementati…   3146      [OK]
tomee                         Apache TomEE is an all-Apache Java EE certif…   93        [OK]
dordoka/tomcat                Ubuntu 14.04, Oracle JDK 8 and Tomcat 8 base…   58                   [OK]
kubeguide/tomcat-app          Tomcat image for Chapter 1                      31
consol/tomcat-7.0             Tomcat 7.0.57, 8080, "admin/admin"              18                   [OK]
cloudesire/tomcat             Tomcat server, 6/7/8                            15                   [OK]
aallam/tomcat-mysql           Debian, Oracle JDK, Tomcat & MySQL              13                   [OK]
arm32v7/tomcat                Apache Tomcat is an open source implementati…   11
andreptb/tomcat               Debian Jessie based image with Apache Tomcat…   10                   [OK]
rightctrl/tomcat              CentOS , Oracle Java, tomcat application ssl…   7                    [OK]
arm64v8/tomcat                Apache Tomcat is an open source implementati…   6
unidata/tomcat-docker         Security-hardened Tomcat Docker container.      5                    [OK]
amd64/tomcat                  Apache Tomcat is an open source implementati…   3
oobsri/tomcat8                Testing CI Jobs with different names.           2
cfje/tomcat-resource          Tomcat Concourse Resource                       2
jelastic/tomcat               An image of the Tomcat Java application serv…   2
fabric8/tomcat-8              Fabric8 Tomcat 8 Image                          2                    [OK]
picoded/tomcat7               tomcat7 with jre8 and MANAGER_USER / MANAGER…   1                    [OK]
99taxis/tomcat7               Tomcat7                                         1                    [OK]
chenyufeng/tomcat-centos      tomcat基于centos6的镜像                              1                    [OK]
ppc64le/tomcat                Apache Tomcat is an open source implementati…   1
camptocamp/tomcat-logback     Docker image for tomcat with logback integra…   1                    [OK]
s390x/tomcat                  Apache Tomcat is an open source implementati…   0
softwareplant/tomcat          Tomcat images for jira-cloud testing            0                    [OK]
secoresearch/tomcat-varnish   Tomcat and Varnish 5.0                          0                    [OK]
[root@VM-0-7-centos ~]#
# 可选项,通过镜像来过滤-f, --filter=STARS=3000   # 搜索出来的镜像就是STARS大于3000的 [root@VM-0-7-centos ~]# docker search tomcat --filter=STARS=3000
NAME      DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
tomcat    Apache Tomcat is an open source implementati…   3146      [OK]
[root@VM-0-7-centos ~]#


docker pull 下载镜像

[root@VM-0-7-centos ~]# docker search mysql
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
mysql                             MySQL is a widely used, open-source relation…   11507     [OK]
mariadb                           MariaDB Server is a high performing open sou…   4367      [OK]
mysql/mysql-server                Optimized MySQL Server Docker images. Create…   850                  [OK]
percona                           Percona Server is a fork of the MySQL relati…   557       [OK]
phpmyadmin                        phpMyAdmin - A web interface for MySQL and M…   336       [OK]
centos/mysql-57-centos7           MySQL 5.7 SQL database server                   91
mysql/mysql-cluster               Experimental MySQL Cluster Docker images. Cr…   88
centurylink/mysql                 Image containing mysql. Optimized to be link…   59                   [OK]
databack/mysql-backup             Back up mysql databases to... anywhere!         51
prom/mysqld-exporter                                                              42                   [OK]
deitch/mysql-backup               REPLACED! Please use http://hub.docker.com/r…   41                   [OK]
tutum/mysql                       Base docker image to run a MySQL database se…   35
linuxserver/mysql                 A Mysql container, brought to you by LinuxSe…   31
schickling/mysql-backup-s3        Backup MySQL to S3 (supports periodic backup…   31                   [OK]
mysql/mysql-router                MySQL Router provides transparent routing be…   23
centos/mysql-56-centos7           MySQL 5.6 SQL database server                   20
arey/mysql-client                 Run a MySQL client from a docker container      18                   [OK]
fradelg/mysql-cron-backup         MySQL/MariaDB database backup using cron tas…   16                   [OK]
yloeffler/mysql-backup            This image runs mysqldump to backup data usi…   7                    [OK]
openshift/mysql-55-centos7        DEPRECATED: A Centos7 based MySQL v5.5 image…   6
devilbox/mysql                    Retagged MySQL, MariaDB and PerconaDB offici…   3
jelastic/mysql                    An image of the MySQL database server mainta…   2
ansibleplaybookbundle/mysql-apb   An APB which deploys RHSCL MySQL                2                    [OK]
widdpim/mysql-client              Dockerized MySQL Client (5.7) including Curl…   1                    [OK]
centos/mysql-80-centos7           MySQL 8.0 SQL database server                   1# 下载一个mysql的镜像,默认下载最新的镜像[root@VM-0-7-centos ~]# docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
07aded7c29c6: Pull complete
f68b8cbd22de: Pull complete
30c1754a28c4: Pull complete
1b7cb4d6fe05: Pull complete
79a41dc56b9a: Pull complete
00a75e3842fb: Pull complete
b36a6919c217: Pull complete
635b0b84d686: Pull complete
6d24c7242d02: Pull complete
5be6c5edf16f: Pull complete
cb35eac1242c: Pull complete
a573d4e1c407: Pull complete
Digest: sha256:4fcf5df6c46c80db19675a5c067e737c1bc8b0e78e94e816a778ae2c6577213d
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]## 下载指定版本的镜像[root@VM-0-7-centos ~]# docker pull mysql:5.7
5.7: Pulling from library/mysql
07aded7c29c6: Already exists
f68b8cbd22de: Already exists
30c1754a28c4: Already exists
1b7cb4d6fe05: Already exists
79a41dc56b9a: Already exists
00a75e3842fb: Already exists
b36a6919c217: Already exists
5e11fe494f45: Pull complete
9c7de1f889a7: Pull complete
cf6a13d05a76: Pull complete
fc5aa81f393a: Pull complete
Digest: sha256:360c7488c2b5d112804a74cd272d1070d264eef4812d9a9cc6b8ed68c3546189
Status: Downloaded newer image for mysql:5.7
docker.io/library/mysql:5.7
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]## 查看下载的所有镜像[root@VM-0-7-centos ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
mysql         5.7       9f35042c6a98   8 days ago    448MB
mysql         latest    2fe463762680   8 days ago    514MB
hello-world   latest    feb5d9fea6a5   12 days ago   13.3kB
[root@VM-0-7-centos ~]#


docker rmi 删除镜像


[root@VM-0-7-centos ~]# docker rmi  9f35042c6a98
Untagged: mysql:5.7
Untagged: mysql@sha256:360c7488c2b5d112804a74cd272d1070d264eef4812d9a9cc6b8ed68c3546189
Deleted: sha256:9f35042c6a98363147ae456147643a3d14c484640f13f4ab207cf2c296839baf
Deleted: sha256:69a5732b5b989ff688326db6354b0f50165a71cfe7579b285054b561fb3c5143
Deleted: sha256:448b1f9cb8f126363f0e809e0e450c493ca1e725715127a258c5346fcae7cd8a
Deleted: sha256:4064542818b4bf92f293da870d3ea1413a20d0c1a83f72917c50986880255338
Deleted: sha256:8ca7f5e08bac7aa39cf9b8b79bf40669373b9aed45ec76eb0fa55109350b6672
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]# docker images
REPOSITORY    TAG       IMAGE ID       CREATED       SIZE
mysql         latest    2fe463762680   8 days ago    514MB
hello-world   latest    feb5d9fea6a5   12 days ago   13.3kB
[root@VM-0-7-centos ~]#

【批量操作】

## 删除所有镜像
[root@VM-0-7-centos ~]# docker rmi -f $(docker images -aq)
[root@VM-0-7-centos ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@VM-0-7-centos ~]## # 删除多个镜像
[root@VM-0-7-centos ~]# docker rmi -f 镜像id 镜像id 镜像id
[root@VM-0-7-centos ~]# docker rmi -f $(docker images -aq)
Untagged: mysql:latest
Untagged: mysql@sha256:4fcf5df6c46c80db19675a5c067e737c1bc8b0e78e94e816a778ae2c6577213d
Deleted: sha256:2fe4637626805dc6df98d3dc17fa9b5035802dcbd3832ead172e3145cd7c07c2
Deleted: sha256:e00bdaa10222919253848d65585d53278a2f494ce8c6a445e5af0ebfe239b3b5
Deleted: sha256:83411745a5928b2a3c2b6510363218fb390329f824e04bab13573e7a752afd50
Deleted: sha256:e8e521a71a92aad623b250b0a192a22d54ad8bbeb943f7111026041dce20d94f
Deleted: sha256:024ee0ef78b28663bc07df401ae3a258ae012bd5f37c2960cf638ab4bc04fafd
Deleted: sha256:597139ec344c8cb622127618ae21345b96dd23e36b5d04b071a3fd92d207a2c0
Deleted: sha256:28909b85bd680fc47702edb647a06183ae5f3e3020f44ec0d125bf75936aa923
Deleted: sha256:4e007ef1e2a3e1e0ffb7c0ad8c9ea86d3d3064e360eaa16e7c8e10f514f68339
Deleted: sha256:b01d7bbbd5c0e2e5ae10de108aba7cd2d059bdd890814931f6192c97fc8aa984
Deleted: sha256:d98a368fc2299bfa2c34cc634fa9ca34bf1d035e0cca02e8c9f0a07700f18103
Deleted: sha256:95968d83b58ae5eec87e4c9027baa628d0e24e4acebea5d0f35eb1b957dd4672
Deleted: sha256:425adb901baf7d6686271d2ce9d42b8ca67e53cffa1bc05622fd0226ae40e9d8
Deleted: sha256:476baebdfbf7a68c50e979971fcd47d799d1b194bcf1f03c1c979e9262bcd364
Untagged: hello-world:latest
Untagged: hello-world@sha256:9ade9cc2e26189a19c2e8854b9c8f1e14829b51c55a630ee675a5a9540ef6ccf
Deleted: sha256:feb5d9fea6a5e9606aa995e879d862b825965ba48de054caab5ef356dc6b3412
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]#
[root@VM-0-7-centos ~]# docker images
REPOSITORY   TAG       IMAGE ID   CREATED   SIZE
[root@VM-0-7-centos ~]#


其他…

https://docs.docker.com/engine/reference/commandline/images/

Docker Review - docker images 常用命令相关推荐

  1. Docker(一):Docker的安装与常用命令

    相关阅读: Docker(一):Docker的安装与常用命令 Docker(二):Docker常用命令之镜像的创建:Dockerfile 与 commit Docker(三):Docker镜像导入与导 ...

  2. docker实践(2)常用命令和DockerFile详解

    <docker实践(1) 入门和springBoot实践部署> <docker实践(2)常用命令和DockerFile详解> <docker实践(3) 仓库registr ...

  3. Docker(三):Docker镜像加速器和常用命令

    镜像加速器(免费) 1.打开阿里云官网,搜索"容器镜像服务". 2.点击左边导航栏"镜像加速器". 3.把加速器地址复制到Docker配置. 在registry ...

  4. Docker Review - docker 容器 常用命令

    文章目录 容器相关的命令 下载一个centos的基础镜像 新建容器并启动 docker run 操作说明 启动并进入容器 查看当前有哪些容器正在运行 docker ps 启动容器 停止容器 重启容器 ...

  5. 一文搞定 Docker 容器技术与常用命令

    简介:Docker 是一个开源的应用容器引擎,基于 Go 语言开发,Docker 可以让开发者打包他们的应用以及依赖包到一个轻量级.可移植的容器中,然后发布到任何流行的系统. Docker 简介 Do ...

  6. Kubernetes与Docker基本概念与常用命令对照

    摘要: Docker是众多用户上手入门的基础容器和编排工具,提供了良好的开发者体验.Kubernetes是强大的容器编排平台,功能丰富.它们有很多概念和操作都有类似之处.我们今天会和大家对比基本概念与 ...

  7. docker的介绍和常用命令

    最近,微服务很火,所以spring cloud , dubbo也跟着一起流行起来了,紧跟其后的则是容器化技术的出现, docker则是容器化技术领头羊, docker是使用google出的go语言开发 ...

  8. Linux下docker的安装及常用命令

    docker主要是用来管理像MySQL.Tomcat.Nginx等软件的,在安装docker之前,首先保证你的系统里没有老版本docker 清除老版本docker,命令过长,用 \ 分行 sudo y ...

  9. docker安装部署和常用命令

    一 添加yum源 yum install epel-release –y yum clean all yum list 二 安装运行Docker yum install docker-io –y sy ...

最新文章

  1. Servlet监听器Listener
  2. Spring Boot中使用PostgreSQL数据库
  3. Ubuntu 12.04 图形界面问题解决 开机死机
  4. getInvokeArg()和setParam配合使用
  5. 计算机专业考研末流211和双非,211大学考985研究生难吗,如何看待本科985学生读研去211学校?...
  6. jQuery学习笔记01:初试jQuery
  7. java如何实现e的次方_java 大数据次方运算
  8. 游戏社交不足怎么办? 游戏发行中的社交化运营经验分享
  9. [转]Basic OCR in OpenCV
  10. Anaconda下载源设置及还原默认
  11. k2p 登录路由器shell失败_斐讯p.to打不开_p.to进不去怎么办?-192路由网
  12. PS常用工具理解及常用快捷键大全
  13. 联想微型计算机改win7,[系统帮助]lenovo联想WIN8改WIN7详细图文全教程
  14. 深度学习笔记 —— 微调
  15. Playing Atari with Deep Reinforcement Learning-笔记
  16. 杂七杂八的网络安全知识
  17. java毕业设计基于的校园头条新闻管理系统的设计与实现mybatis+源码+调试部署+系统+数据库+lw
  18. 谷歌浏览器夜间模式切换
  19. IT是未来大趋势,有学计算机专业的同学会后悔和转行原因在哪?
  20. FHS—文件系统层次结构标准

热门文章

  1. php queryList函数,QueryList/QueryList.php at master · baijunyao/QueryList · GitHub
  2. 帝豪gl车机系统降级_从拥有帝豪GL开始,出行的好伴侣,说说感受
  3. 采用 opencv surf 算子进行特征匹配
  4. pyspark.sql.DataFrame与pandas.DataFrame之间的相互转换
  5. linux 统计日志最多的ip,统计nginx日志里访问次数最多的前十个IP
  6. 整数的二进制表达中有多少个1
  7. python包介绍:numpy
  8. 深度学习核心技术精讲100篇(七十六)-分类-决策树
  9. Flink从入门到精通100篇(二十三)-Apache Flink在滴滴的应用与实践
  10. Java 应用线上问题排查思路、常用工具小结