docker镜像常用命令:
1.搜索镜像, 优先选官方,stars数量多
例子:docker search mysql
2.拉取镜像(下载镜像)
例子: #默认拉取最新版 docker pull mysql #拉取指定版本 docker pull mysql:5.6
3.推送镜像(上传镜像)
例子:docker push mysql:5.6
4.导入镜像
例子: docker load -i docker_nginx.tar.gz
5.导出镜像
例子:docker save centos:7 -o docker_centos7.tar.gz -o 指定压缩包位置
6.查看镜像列表
例子:docker images
7.删除镜像
例子:docker rmi 镜像id docker rmi 镜像名字:版本
8.给镜像打标签
例子:docker tag 镜像名字:版本
9.自动构建docker镜像
docker build -t centos7_nginx_v1 /opt/dockerfile/centos7_nginx_v1/dockerfile -t 指定镜像名字参数 centos7_nginx_v1 镜像名字参数 /opt/dockerfile/centos7_nginx_v1/dockerfile dockerfile文件的绝对路径
10.显示镜像的历史命令
[root@docker01 ~]# docker history kod:v9 IMAGE CREATED CREATED BY SIZE COMMENT 29c2786cc6dc 39 hours ago /bin/sh -c #(nop) CMD ["/bin/bash" "/init.s… 0B 437a9154401e 39 hours ago /bin/sh -c #(nop) ADD file:6555911795b30a6f4… 279B b6bb24d11de2 39 hours ago /bin/sh -c yum install mariadb-server -y 258MB 2b32eeb2a32d 39 hours ago /bin/sh -c chown -R nginx:nginx . 46.4MB 59b9f463acc0 39 hours ago /bin/sh -c unzip kodexplorer4.40.zip 32.5MB 3226baa0d647 39 hours ago /bin/sh -c yum install unzip -y 143MB
未完待续……
赞赏
微信赞赏
支付宝赞赏