1 获取镜像
基础镜像拉取
docker search centos
docker pull centos:6.9
docker pull centos:7.5.1804
docker search nginx
docker pull nginx
2 镜像基本查看
[root@docker ~]# docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
centos 6.8 82f3b5f3c58f 4 months ago 195 MB
centos 6.9 2199b8eb8390 4 months ago 195 MB
centos 7.5.1804 cf49811e3cdb 4 months ago 200 MB
centos 7.6.1810 f1cb7c7d58b7 4 months ago 202 MB
oldguo/centos_sshd v1.0
oldguo/centos_sshd v2.0
oldguo/centos_sshd v3.0
标识镜像唯一性的方法:
** REPOSITORY:TAG
centos:7.5.1804
** IMAGE ID (sha256:64位的号码,默认只截取12位)
82f3b5f3c58
[root@docker /]# docker image ls --no-trunc
3 镜像详细信息查看
[root@docker /]# docker image inspect ubuntu:latest
[root@docker /]# docker image inspect 82f3b5f3c58f
4 只查看镜像ID
[root@docker ~]# docker image ls -
5 镜像的导入和导出
[root@docker ~]# docker image save 3556258649b2 >/tmp/ubu.tar
[root@docker ~]# docker image rm 3556258649b2
[root@docker ~]# docker image load -i /tmp/ubu.tar
[root@docker ~]# docker image tag 3556258649b2 oldguo/ubu:v1
6 镜像的删除
[root@docker ~]# docker image rm -f 3556258649b2
[root@docker ~]# docker image rm -f `docker image ls -q