1. docker 运行测试
docker run learn/tutorial echo "hello word"
由于本地没有此镜像,会执行 docker pull learn/tutorial & docker run learn/tutorial
2.查看现有镜像 docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
learn/tutorial latest a7876479f1aa 7 years ago 128MB
3.拉取远程镜像
docker pull debian
docker pull ubuntu:18.04
docker pull centos:7.6.1810
4.docker image ls
REPOSITORY TAG IMAGE ID CREATED SIZE
debian latest e7d08cddf791 6 weeks ago 114MB
ubuntu 18.04 2c047404e52d 3 months ago 63.3MB
centos 7.6.1810 f1cb7c7d58b7 23 months ago 202MB
learn/tutorial latest a7876479f1aa 7 years ago 128MB
5.导入导出删除 image
#导出 docker image save 2c047404e52d > /tmp/ubu.tar
# 查看 ll /tmp/ubu.tar
# -rw-r–r–. 1 root root 65651200 2月 28 17:45 /tmp/ubu.tar
# 先把老的删除
# docker image rm -f 2c047404e52d
# 导入
# docker image load -i /tmp/ubu.tar
# 打个标签
# docker image tag 2c047404e52d ubuntu:18.04
6.删除镜像
# 删除所有镜像
docker rmi `docker image ls -q`
# 删除没有打标签的镜像
docker rmi `docker images -q | awk ‘/^
#删除包含关键词的镜像
docker rmi –force `docker images | grep mykey | awk ‘{print $3}’` //其中mykey为关键字
7.镜像的详细信息查询
docker image inspect ubuntu:18.04