Docker 常用命令

帮助命令

docker version    --版本信息
docker info       --详细信息
docker --help     --帮助

镜像命令

1.docker images

    -- List Local 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                                   #显示完整 Image ID
  -q, --quiet           Only show numeric IDs                                   #只显示Image ID.
示例:
docker images
docker images -a
docker images -qa
docker images -a --no-trunc
  

2.docker search

    -- Search the Docker Hub for images 在 Docker Hub 搜索镜像
Options:
      -f, --filter filter Filter output based on conditions provided      #过滤,通常用法 --filter stars=80
          --format string Pretty-print search using a Go template         
          --limit int Max number of search results (default 25)           #显示条目数量
          --no-trunc Don't truncate output                                #显示完整说明
示例:
docker search mysql
------------------------
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
mysql MySQL is a widely used, open-source relation… [OK]
mariadb MariaDB is a community-developed fork of MyS… [OK]
mysql/mysql-server Optimized MySQL Server Docker images. Create… [OK]

docker search --filter STARS= MYSQL
docker search --filter is-official=true mysql
docker search --filter is-automated=true mysql
docker search --filter stars= --limit mysql

3.docker pull

    -- Pull an image or a repository from a registry 拉取镜像
Options:
  -a, --all-tags                Download all tagged images in the repository    #下载所有版本
      --disable-content-trust   Skip image verification (default true)          #默认,跳过镜像验证  
示例:
docker pull mysql
docker pull mysql:5.7.
docker pull redis
docker pull tomcat

[root@localhost ~]# docker pull mysql
Using default tag: latest
latest: Pulling from library/mysql
27833a3ba0a5: Pull complete
864c283b3c4b: Pull complete
cea281b2278b: Pull complete
8f856c14f5af: Pull complete
9c4f38c23b6f: Pull complete
1b810e1751b3: Pull complete
5479aaef3d30: Pull complete
ded8fa2e1614: Pull complete
636033ba4d2e: Pull complete
902e6010661d: Pull complete
dbe44d2bf055: Pull complete
e906385f419d: Pull complete
Digest: sha256:a7cf659a764732a27963429a87eccc8457e6d4af0ee9d5140a3b56e74986eed7
Status: Downloaded newer image for mysql:latest

4.docker rmi

    -- Remove one or more images 删除镜像
Options:
  -f, --force      Force removal of the image        #强制删除镜像
      --no-prune   Do not delete untagged parents    #
示例:
docker rmi hello-world
docker rmi -f hello-world
[root@localhost ~]# docker rmi hello-world
Error response from daemon: conflict: unable to remove repository reference "hello-world" (must force) - container 3af63c5c69c6 is using its referenced image fce289e99eb9
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3af63c5c69c6 hello-world "/hello" hours ago Exited () hours ago pensive_dubinsky
[root@localhost ~]# docker rmi -f hello-world
Untagged: hello-world:latest
Untagged: hello-world@sha256:2557e3c07ed1e38f26e389462d03ed943586f744621577a99efb77324b0fe535
Deleted: sha256:fce289e99eb9bca977dae136fbe2a82b6b7d4c372474c9235adc1741675f587e
[root@localhost ~]# docker imag
es -a
REPOSITORY TAG IMAGE ID CREATED SIZE
mysql latest 7bb2586065cd days ago 477MB
[root@localhost ~]# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3af63c5c69c6 fce289e99eb9 "/hello" hours ago Exited () hours ago pensive_dubinsky

# docker pull hello-world
# docker pull nginx
# docker pull redis
# docker pull python
# docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
python latest 59a8c21b72d4 days ago 929MB
redis latest a55fbf438dfd days ago 95MB
mysql latest 7bb2586065cd days ago 477MB
nginx latest 2bcb04bdb83f days ago 109MB
hello-world latest fce289e99eb9 months ago .84kB

[root@localhost ~]# docker rmi python hello-world

Docker 常用命令——镜像的更多相关文章

  1. docker无法删除镜像,Error: No such container,附docker常用命令

    最近打算删除掉docker镜像但是发现有几个镜像就是删除不了,加了-f强制删除也不行,一直报Error: No such container的错误,最后终于找到了办法直接删除文件,步骤如下: 切换到r ...

  2. docker常用命令、镜像命令、容器命令、数据卷,使用dockerFile创建镜像,dockefile的语法规则。

    一.docker常用命令? 1. 常用帮助命令 1.1 docker的信息以及版本号 /* docker info 查看docker的信息 images2 docker本身就是一个镜像. docker ...

  3. 【Docker】(3)---linux部署Docker、Docker常用命令

    linux部署Docker.Docker常用命令 本次部署Linux版本:CentOS 7.4 64位. 说明: 因为Docker是基于Linux 64bit的 所以Docker要求64位的系统且内核 ...

  4. Docker常用命令(二)

    Docker常用命令 查看Docker所有正在运行的容器 docker ps 查看Docker已退出的容器 docker ps -a 查看Docker所有镜像 docker images 删除镜像 删 ...

  5. Docker应用二:docker常用命令介绍

     Docker常用命令使用介绍 docker中常用的命令: 1.docker search image_name:搜查镜像 2.docker pull image_name:从镜像库中拉去镜像 3.d ...

  6. Docker常用命令汇总,和常用操作举例

    Docker命令 docker 常用命令如下 管理命令: container 管理容器 image 管理镜像 network 管理网络 node 管理Swarm节点 plugin 管理插件 secre ...

  7. 1021 docker常用命令和Jenkins搭建

    docker常用命令 1.镜像管理 docker pull (镜像名) # 默认拉取最新版本的镜像 docker pull (镜像名:版本号) #拉取指定版本的镜像 docker push (镜像名) ...

  8. docker 常用 命令

    http://os.51cto.com/art/201409/451117.htm 2.1 在测试机启动容器,安装ssh docker run -i -t ubuntu /bin/bash #此方式运 ...

  9. Docker 常用命令总结

    Docker 常用命令总结   回到顶部 镜像相关 搜索 docker search *image_name* 下载 docker pull *image_name* 查看 docker images ...

随机推荐

  1. ajax异步上传图片三种方案

    转自:http://www.jb51.net/article/51180.htm 注:自己尝试了前两种,都可用: 目前常用的异步文件上传功能有几种,比较多见的如使用iframe框架形式,ajax功能效 ...

  2. JS 数据容量转换/换算

    function diskSize(num){ if (num == 0) return '0 B'; var k = 1024; //设定基础容量大小 var sizeStr = ['B','KB' ...

  3. 实现键盘记录的e.Whick和keyCode,兼容FireFox和IE

    主要分四个部分第一部分:浏览器的按键事件第二部分:兼容浏览器第三部分:代码实现和优化第四部分:总结 第一部分:浏览器的按键事件 用js实现键盘记录,要关注浏览器的三种按键事件类型,即keydown,k ...

  4. 理解android中ListFragment和Loader

    一直以来不知Android中Loader怎么用,今天晚上特意花了时间来研究,算是基本上搞明白了,现在把相关的注释和代码发出来,以便笔记和给网友一个参考,错误之处还望大家给我留言,共同进步,这个例子采用 ...

  5. MySQL中有关char、varchar、int、tinyint、decimal

    char.varchar属于字符串类型 1.char属于定长,能确切的知道列值的长度,也就是有多少个字符.当指定char(5)时,表示只能存5个字符,如5个英文‘a’,5个汉字‘我’,5个符号‘&am ...

  6. 星空灯改装成USB供电

    简单的手工活,20分钟搞定 1.用一根USB线剪断,将红黑两根线分别连接到星空灯电源供电的正负极 2.由于USB输出5V 0.5A的电流,因此需要改装下,办法一,加电阻,办法二,换灯泡,由于小电阻并不 ...

  7. java笔记--代码实现汉诺塔移动过程和移动次数

    汉诺塔 有三根相邻的柱子,标号为A,B,C,A柱子上从下到上按金字塔状叠放着n个不同大小的圆盘,要把所有盘子一个一个移动到柱子B上,并且每次移动同一根柱子上都不能出现大盘子在小盘子上方. --如果朋友 ...

  8. Druid学习---配置_DruidDataSource参考配置

    [更多参考]https://www.cnblogs.com/niejunlei/p/5977895.html 配置_DruidDataSource参考配置 以下是一个参考的连接池配置: <bea ...

  9. 沉淀再出发:用python画各种图表

    沉淀再出发:用python画各种图表 一.前言 最近需要用python来做一些统计和画图,因此做一些笔记. 二.python画各种图表 2.1.使用turtle来画图 import turtle as ...

  10. python 实现插入排序、冒泡排序、归并排序

    def InsertSort(A): '''插入排序算法:传入一个list,对list中的数字进行排序''' print('插入排序前list元素顺序:',A) length=len(A) for i ...