版本信息

  1. docker version #版本信息
  2. docker info #
  3. docker 命令 --help
  4. 帮助文档https://docs.docker.com/reference/

查看本机所有镜像

docker images

  1. [root@iZbp1d0213clo5fn6z0fsfZ ~]# docker images
  2. REPOSITORY TAG IMAGE ID CREATED SIZE
  3. jenkins/jenkins latest ce038d88aadd 4 weeks ago 580MB
  4. mysql 8 0627ec6901db 5 weeks ago 556MB
  5. hello-world latest d1165f221234 2 months ago 13.3kB
  6. #解释
  7. REPOSITORY 镜像的仓库源
  8. TAG 镜像的标签
  9. IMAGE ID 镜像的id
  10. CREATED 镜像的创建时间
  11. SIZE 镜像的大小
  12. # 可选项
  13. -a , --all # 列出所有的镜像
  14. -q, --quiet # 只显示镜像的id

搜索命令

docker search

  1. [root@iZbp1d0213clo5fn6z0fsfZ ~]# docker search mysql
  2. NAME DESCRIPTION STARS OFFICIAL AUTOMATED
  3. mysql MySQL is a widely used, open-source relation 10932 [OK]
  4. mariadb MariaDB Server is a high performing open sou 4134 [OK]
  5. # 可选项 通过搜索来过滤
  6. --fliter=STARS=3000 #搜索出来的STARS是3000以上的

下载镜像

docker pull 镜像名 [:tag]版本

  1. docker pull 镜像名 [:tag]版本
  2. [root@iZbp1d0213clo5fn6z0fsfZ ~]# docker pull mysql
  3. Using default tag: latest # 如果不写 tag. 默认就是 latest
  4. latest: Pulling from library/mysql
  5. 69692152171a: Pull complete # 分层下载, docker iamge的核心 联合文件系统
  6. 1651b0be3df3: Pull complete
  7. 951da7386bc8: Pull complete
  8. 0f86c95aa242: Pull complete
  9. 37ba2d8bd4fe: Pull complete
  10. 6d278bb05e94: Pull complete
  11. 497efbd93a3e: Pull complete
  12. f7fddf10c2c2: Pull complete
  13. 16415d159dfb: Pull complete
  14. 0e530ffc6b73: Pull complete
  15. b0a4a1a77178: Pull complete
  16. cd90f92aa9ef: Pull complete
  17. Digest: sha256:d50098d7fcb25b1fcb24e2d3247cae3fc55815d64fec640dc395840f8fa80969 # 签名
  18. Status: Downloaded newer image for mysql:latest
  19. docker.io/library/mysql:latest # 真是地址
  20. #等价于
  21. docker pull mysql
  22. docker pull docker.io/library/mysql:latest

删除镜像

docker rmi -f 镜像id

  1. # 删除镜像
  2. docker rmi -f 根据id删除
  3. # 批量删除 所有容器
  4. docker rmi -f $(docker images -aq) # 通过查出id批量删除