docker三:docker镜像命令

1.搜索docker镜像:

# docker search httpd   #如搜索httpd的docker镜像

 镜像选择:

  • 优先使用官方的
  • starts数量多的

 2.安装docker镜像:

# docker pull httpd:2.2

 3.从第三方docker镜像地址,下载docker镜像:docker pull

  镜像加速度器:阿里云加速器,daoclound加速器,中科大加速器,docker中国(https://registry.docker-cn.com)  

docker pull daoclond.io/huangzhichong/alpine-cn:latest

4.配置docker镜像加速

# vim /etc/docker/daemon.json

{
  "registry-mirrors": ["https://registry.docker-cn.com"]
}

5.重启docker容器

更改docker镜像后,需要重启docker服务

#systemctl restart docker

6.查看已安装的docker镜像列表

# docker image ls

7.导出一个镜像

docker save nginx:latest  >docker_nginx.tzr.gz

8.删除一个镜像

# docker image rm nginx:latest 

9.导入一个镜像

# docker load -i docker_nginx.tar.gz

 10.查看镜像操作有哪些子命令:docker image

Commands:
  build       Build an image from a Dockerfile,创建一个镜像
  history     Show the history of an image,查看构建镜像的历史信息
  import      Import the contents from a tarball to create a filesystem image,这种方法不好,会丢失版本信息
  inspect     Display detailed information on one or more images,查看一个镜像的详细信息
  load        Load an image from a tar archive or STDIN,导入一个镜像
  ls          List images,列出镜像
  prune       Remove unused images,批量删除镜像
  pull        Pull an image or a repository from a registry,上传镜像
  push        Push an image or a repository to a registry,下载镜像
  rm          Remove one or more images,删除一个镜像
  save        Save one or more images to a tar archive (streamed to STDOUT by default),导出一个镜像
  tag         Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE,创建一个镜像的硬链接

 

posted on 2019-08-04 20:55  myworldworld  阅读(223)  评论(0)    收藏  举报

导航